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>
* TODO: more updates

View File

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

10
TODO
View File

@ -5,17 +5,15 @@ Before 1.0:
- or block unloading until all processes have exited
* 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
move them)
- Consider expanding a few more levels of a new descendants tree
* Build system
- Find out if that PREFIX business in Makefile was really such
a great idea.
- need to run depmod on install
- add an "install-module" target
- Find out what distributions it actually works on
(ask for sucess/failure-stories in 0.9.x releases)
- auto*?
Before 1.2:
@ -266,6 +264,10 @@ Later:
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
a dialog if not. Note we must be able to start without module now,
since it is useful to just load profiles from disk.

View File

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

View File

@ -84,6 +84,8 @@ struct Application
int timeout_id;
int generating_profile;
char * loaded_profile;
gboolean profile_from_file; /* FIXME - not10: This is a kludge. Figure out how
* to maintain the application model properly
@ -118,6 +120,10 @@ show_samples_timeout (gpointer data)
case DISPLAYING:
label = g_strdup_printf ("Samples: %d", app->n_samples);
break;
default:
g_assert_not_reached();
break;
}
gtk_label_set_label (GTK_LABEL (app->samples_label), label);
@ -179,6 +185,10 @@ update_sensitivity (Application *app)
sensitive_samples_label = FALSE;
active_radio_button = app->profile_button;
break;
default:
g_assert_not_reached();
break;
}
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (active_radio_button), TRUE);
@ -215,7 +225,7 @@ update_sensitivity (Application *app)
gtk_widget_set_sensitive (GTK_WIDGET (app->callers_view), sensitive_tree_views);
gtk_widget_set_sensitive (GTK_WIDGET (app->descendants_view), sensitive_tree_views);
gtk_widget_set_sensitive (GTK_WIDGET (app->samples_label), sensitive_samples_label);
queue_show_samples (app);
}
@ -356,6 +366,33 @@ on_read (gpointer data)
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
delete_data (Application *app)
{
@ -376,6 +413,7 @@ delete_data (Application *app)
app->n_samples = 0;
queue_show_samples (app);
app->profile_from_file = FALSE;
set_application_title (app, NULL);
}
static void
@ -913,6 +951,7 @@ on_save_as_clicked (gpointer widget,
g_free (filename);
goto retry;
}
set_application_title (app, filename);
set_busy (dialog, FALSE);
g_free (filename);
}
@ -940,6 +979,8 @@ set_loaded_profile (Application *app,
app->profile_from_file = TRUE;
fill_lists (app);
set_application_title (app, name);
update_sensitivity (app);
@ -1159,7 +1200,7 @@ set_sizes (GtkWindow *window,
}
static void
set_shadows (GladeXML *xml)
set_shadows (void)
{
/* Get rid of motif out-bevels */
gtk_rc_parse_string (
@ -1180,14 +1221,14 @@ build_gui (Application *app)
GladeXML *xml;
GtkTreeSelection *selection;
GtkTreeViewColumn *col;
set_shadows (xml);
set_shadows ();
xml = glade_xml_new (DATADIR "/sysprof.glade", NULL, NULL);
/* 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);

View File

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