Update the title bar on load/save

Sat May 14 16:36:32 2005  Søren Sandmann  <sandmann@redhat.com>

	* sysprof.c (set_application_title): Update the title bar on
	load/save

	* treeviewutils.c, sfile.c: Fix compiler warnings

	* Makefile.am: define PIXMAPDIR

Sat May 14 15:49:52 2005  Søren Sandmann  <sandmann@redhat.com>

	Auto*ify.

	* TODO: updates

	* AUTHORS, INSTALL, Makefile.am, NEWS, configure.ac: New files

	* module/Makefile: New file

	* module/sysprof-module.c, module/sysprof-module.h: Move these
	files to their own directy, as the kernel build system does not
	work very well with auto*.

	* sysprof.c, autogen.sh: Some auto* changes.
This commit is contained in:
Søren Sandmann
2005-05-14 20:38:03 +00:00
committed by Søren Sandmann Pedersen
parent 71db050480
commit 55fd84676f
6 changed files with 83 additions and 14 deletions

View File

@ -1,3 +1,28 @@
Sat May 14 16:36:32 2005 Søren Sandmann <sandmann@redhat.com>
* sysprof.c (set_application_title): Update the title bar on
load/save
* treeviewutils.c, sfile.c: Fix compiler warnings
* Makefile.am: define PIXMAPDIR
Sat May 14 15:49:52 2005 Søren Sandmann <sandmann@redhat.com>
Auto*ify.
* TODO: updates
* AUTHORS, INSTALL, Makefile.am, NEWS, configure.ac: New files
* module/Makefile: New file
* module/sysprof-module.c, module/sysprof-module.h: Move these
files to their own directy, as the kernel build system does not
work very well with auto*.
* sysprof.c, autogen.sh: Some auto* changes.
Sun May 8 16:31:32 2005 Søren Sandmann <sandmann@redhat.com> Sun May 8 16:31:32 2005 Søren Sandmann <sandmann@redhat.com>
* TODO: more updates * TODO: more updates

View File

@ -24,7 +24,7 @@ sysprof_LDADD = $(DEP_LIBS)
INCLUDES = \ INCLUDES = \
$(DEP_CFLAGS) \ $(DEP_CFLAGS) \
-DDATADIR=\"$(pkgdatadir)\" \ -DDATADIR=\"$(pkgdatadir)\" \
-DPKGLIBDIR=\"$(pkglibdir)\" -DPIXMAPDIR=\"$(datadir)/pixmaps\"
# memprof.desktop # memprof.desktop
# memprof.spec.in # memprof.spec.in

10
TODO
View File

@ -5,17 +5,15 @@ Before 1.0:
- or block unloading until all processes have exited - or block unloading until all processes have exited
* Interface * Interface
- If the current profile has a name, display it in the title bar
- hook up menu items view/start etc (or possibly get rid of them or - hook up menu items view/start etc (or possibly get rid of them or
move them) move them)
- Consider expanding a few more levels of a new descendants tree - Consider expanding a few more levels of a new descendants tree
* Build system * Build system
- Find out if that PREFIX business in Makefile was really such - need to run depmod on install
a great idea. - add an "install-module" target
- Find out what distributions it actually works on - Find out what distributions it actually works on
(ask for sucess/failure-stories in 0.9.x releases) (ask for sucess/failure-stories in 0.9.x releases)
- auto*?
Before 1.2: Before 1.2:
@ -266,6 +264,10 @@ Later:
DONE: DONE:
- If the current profile has a name, display it in the title bar
- auto*?
- Find out if that PREFIX business in Makefile was really such
a great idea.
- Sould just install the kernel module if it running as root, pop up - Sould just install the kernel module if it running as root, pop up
a dialog if not. Note we must be able to start without module now, a dialog if not. Note we must be able to start without module now,
since it is useful to just load profiles from disk. since it is useful to just load profiles from disk.

View File

@ -1547,8 +1547,10 @@ sfile_output_save (SFileOutput *sfile,
GString *output; GString *output;
int indent; int indent;
gboolean retval; gboolean retval;
#if 0
guchar *compressed; guchar *compressed;
size_t compressed_size; size_t compressed_size;
#endif
g_return_val_if_fail (sfile != NULL, FALSE); g_return_val_if_fail (sfile != NULL, FALSE);
@ -1606,9 +1608,9 @@ sfile_output_save (SFileOutput *sfile,
*/ */
bz2_compress (output->str, output->len, bz2_compress (output->str, output->len,
&compressed, &compressed_size); &compressed, &compressed_size);
#endif
g_free (compressed); g_free (compressed);
#endif
retval = file_replace (filename, output->str, - 1, err); retval = file_replace (filename, output->str, - 1, err);
@ -1635,7 +1637,7 @@ sfile_output_free (SFileOutput *sfile)
int n_instructions; int n_instructions;
n_instructions = sfile->instructions->len; n_instructions = sfile->instructions->len;
instructions = g_array_free (sfile->instructions, FALSE); instructions = (Instruction *)g_array_free (sfile->instructions, FALSE);
free_instructions (instructions, n_instructions); free_instructions (instructions, n_instructions);

View File

@ -85,6 +85,8 @@ struct Application
int timeout_id; int timeout_id;
int generating_profile; int generating_profile;
char * loaded_profile;
gboolean profile_from_file; /* FIXME - not10: This is a kludge. Figure out how gboolean profile_from_file; /* FIXME - not10: This is a kludge. Figure out how
* to maintain the application model properly * to maintain the application model properly
* *
@ -118,6 +120,10 @@ show_samples_timeout (gpointer data)
case DISPLAYING: case DISPLAYING:
label = g_strdup_printf ("Samples: %d", app->n_samples); label = g_strdup_printf ("Samples: %d", app->n_samples);
break; break;
default:
g_assert_not_reached();
break;
} }
gtk_label_set_label (GTK_LABEL (app->samples_label), label); gtk_label_set_label (GTK_LABEL (app->samples_label), label);
@ -179,6 +185,10 @@ update_sensitivity (Application *app)
sensitive_samples_label = FALSE; sensitive_samples_label = FALSE;
active_radio_button = app->profile_button; active_radio_button = app->profile_button;
break; break;
default:
g_assert_not_reached();
break;
} }
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (active_radio_button), TRUE); gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (active_radio_button), TRUE);
@ -356,6 +366,33 @@ on_read (gpointer data)
update_sensitivity (app); update_sensitivity (app);
} }
static void
set_application_title (Application *app,
const char * name)
{
char *new_name;
if (name)
new_name = g_path_get_basename (name);
else
new_name = NULL;
if (app->loaded_profile)
g_free (app->loaded_profile);
app->loaded_profile = new_name;
if (app->loaded_profile)
{
gtk_window_set_title (GTK_WINDOW (app->main_window),
app->loaded_profile);
}
else
{
gtk_window_set_title (GTK_WINDOW (app->main_window),
"System Profiler");
}
}
static void static void
delete_data (Application *app) delete_data (Application *app)
{ {
@ -376,6 +413,7 @@ delete_data (Application *app)
app->n_samples = 0; app->n_samples = 0;
queue_show_samples (app); queue_show_samples (app);
app->profile_from_file = FALSE; app->profile_from_file = FALSE;
set_application_title (app, NULL);
} }
static void static void
@ -913,6 +951,7 @@ on_save_as_clicked (gpointer widget,
g_free (filename); g_free (filename);
goto retry; goto retry;
} }
set_application_title (app, filename);
set_busy (dialog, FALSE); set_busy (dialog, FALSE);
g_free (filename); g_free (filename);
} }
@ -941,6 +980,8 @@ set_loaded_profile (Application *app,
fill_lists (app); fill_lists (app);
set_application_title (app, name);
update_sensitivity (app); update_sensitivity (app);
set_busy (app->main_window, FALSE); set_busy (app->main_window, FALSE);
@ -1159,7 +1200,7 @@ set_sizes (GtkWindow *window,
} }
static void static void
set_shadows (GladeXML *xml) set_shadows (void)
{ {
/* Get rid of motif out-bevels */ /* Get rid of motif out-bevels */
gtk_rc_parse_string ( gtk_rc_parse_string (
@ -1181,13 +1222,13 @@ build_gui (Application *app)
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkTreeViewColumn *col; GtkTreeViewColumn *col;
set_shadows (xml); set_shadows ();
xml = glade_xml_new (DATADIR "/sysprof.glade", NULL, NULL); xml = glade_xml_new (DATADIR "/sysprof.glade", NULL, NULL);
/* Main Window */ /* Main Window */
app->main_window = glade_xml_get_widget (xml, "main_window"); app->main_window = glade_xml_get_widget (xml, "main_window");
app->icon = gdk_pixbuf_new_from_file (DATADIR"/pixmaps" "/sysprof-icon.png", NULL); app->icon = gdk_pixbuf_new_from_file (PIXMAPDIR "/sysprof-icon.png", NULL);
gtk_window_set_icon (GTK_WINDOW (app->main_window), app->icon); gtk_window_set_icon (GTK_WINDOW (app->main_window), app->icon);

View File

@ -217,10 +217,9 @@ void
restore_sort_state (GtkTreeView *view, gpointer st) restore_sort_state (GtkTreeView *view, gpointer st)
{ {
SortState *state = st; SortState *state = st;
GtkTreeModel *model; GtkTreeModel *model = gtk_tree_view_get_model (view);
if (state) { if (state) {
model = gtk_tree_view_get_model (view);
if (state->is_sorted && model && GTK_IS_TREE_SORTABLE (model)) { if (state->is_sorted && model && GTK_IS_TREE_SORTABLE (model)) {
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
state->sort_column, state->sort_column,