mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 15:10:53 +00:00
Remove "loading and saving"
Fri Mar 25 19:39:24 2005 Søren Sandmann <sandmann@redhat.com> * TODO: Remove "loading and saving" * sysprof.glade: Add ellipsises to Open and Save menu items. * sysprof.c (overwrite_file): Add this function, cutted-and-pasted from evince. * sysprof.c (on_save_as_clicked, on_open_clicked): Use GtkFileChoosers to pick the names. * sysprof.c: Various GUI updates.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
50c62b0804
commit
0901851c45
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
|||||||
|
Fri Mar 25 19:39:24 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
* TODO: Remove "loading and saving"
|
||||||
|
|
||||||
|
* sysprof.glade: Add ellipsises to Open and Save menu items.
|
||||||
|
|
||||||
|
* sysprof.c (overwrite_file): Add this function, cutted-and-pasted
|
||||||
|
from evince.
|
||||||
|
|
||||||
|
* sysprof.c (on_save_as_clicked, on_open_clicked): Use
|
||||||
|
GtkFileChoosers to pick the names.
|
||||||
|
|
||||||
|
* sysprof.c: Various GUI updates.
|
||||||
|
|
||||||
|
Fri Mar 25 19:36:28 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
* sfile.c (bz2_compress): Add this function Don't actually make
|
||||||
|
any produce use of it.
|
||||||
|
|
||||||
|
* profile.c (make_hash_table): Get rid of warning
|
||||||
|
|
||||||
Thu Mar 24 19:09:33 2005 Søren Sandmann <sandmann@redhat.com>
|
Thu Mar 24 19:09:33 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* sysprof.c: Various GUI updates
|
* sysprof.c: Various GUI updates
|
||||||
|
|||||||
4
Makefile
4
Makefile
@ -6,8 +6,8 @@ CFLAGS += $(MODCFLAGS) -DKERNEL26
|
|||||||
else
|
else
|
||||||
|
|
||||||
CFLAGS := $(shell pkg-config --cflags gtk+-2.0 libglade-2.0) -Wall -g
|
CFLAGS := $(shell pkg-config --cflags gtk+-2.0 libglade-2.0) -Wall -g
|
||||||
LIBS := $(shell pkg-config --libs gtk+-2.0 libglade-2.0) -lbfd -liberty
|
LIBS := $(shell pkg-config --libs gtk+-2.0 libglade-2.0) -lbfd -liberty -lbz2
|
||||||
C_FILES := sysprof.c binfile.c stackstash.c watch.c process.c \
|
C_FILES := sysprof.c binfile.c stackstash.c watch.c process.c \
|
||||||
profile.c treeviewutils.c sfile.c
|
profile.c treeviewutils.c sfile.c
|
||||||
OBJS := $(addsuffix .o, $(basename $(C_FILES)))
|
OBJS := $(addsuffix .o, $(basename $(C_FILES)))
|
||||||
BINARY := sysprof
|
BINARY := sysprof
|
||||||
|
|||||||
4
TODO
4
TODO
@ -30,8 +30,6 @@
|
|||||||
- kernel module should put process to sleep before sampling. Should get us
|
- kernel module should put process to sleep before sampling. Should get us
|
||||||
more accurate data
|
more accurate data
|
||||||
|
|
||||||
- loading and saving
|
|
||||||
|
|
||||||
- make profile.c more agnostic to processes and functions etc. Ideally
|
- make profile.c more agnostic to processes and functions etc. Ideally
|
||||||
it should just take a set of stack traces containing "presentation
|
it should just take a set of stack traces containing "presentation
|
||||||
objects" and do something sensible with it.
|
objects" and do something sensible with it.
|
||||||
@ -51,6 +49,8 @@
|
|||||||
|
|
||||||
DONE:
|
DONE:
|
||||||
|
|
||||||
|
- loading and saving
|
||||||
|
|
||||||
- consider making ProfileObject more of an object.
|
- consider making ProfileObject more of an object.
|
||||||
|
|
||||||
- make an "everything" object
|
- make an "everything" object
|
||||||
|
|||||||
@ -163,9 +163,7 @@ make_hash_table (Node *node, GHashTable *table)
|
|||||||
node->next = g_hash_table_lookup (table, node->object);
|
node->next = g_hash_table_lookup (table, node->object);
|
||||||
g_hash_table_insert (table, node->object, node);
|
g_hash_table_insert (table, node->object, node);
|
||||||
|
|
||||||
g_print ("added %s\n", node->object->name);
|
g_assert (node->siblings != (void *)0x11);
|
||||||
|
|
||||||
g_assert (node->siblings != 0x11);
|
|
||||||
|
|
||||||
make_hash_table (node->siblings, table);
|
make_hash_table (node->siblings, table);
|
||||||
make_hash_table (node->children, table);
|
make_hash_table (node->children, table);
|
||||||
@ -230,7 +228,7 @@ profile_load (const char *filename, GError **err)
|
|||||||
if (!profile->call_tree)
|
if (!profile->call_tree)
|
||||||
profile->call_tree = node;
|
profile->call_tree = node;
|
||||||
|
|
||||||
g_assert (node->siblings != 0x11);
|
g_assert (node->siblings != (void *)0x11);
|
||||||
}
|
}
|
||||||
sfile_end_get (input, "nodes", NULL);
|
sfile_end_get (input, "nodes", NULL);
|
||||||
sfile_end_get (input, "profile", NULL);
|
sfile_end_get (input, "profile", NULL);
|
||||||
|
|||||||
88
sfile.c
88
sfile.c
@ -4,6 +4,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <bzlib.h>
|
||||||
#include "sfile.h"
|
#include "sfile.h"
|
||||||
|
|
||||||
typedef struct State State;
|
typedef struct State State;
|
||||||
@ -850,7 +851,6 @@ handle_text (GMarkupParseContext *context,
|
|||||||
|
|
||||||
instruction.name = NULL;
|
instruction.name = NULL;
|
||||||
instruction.kind = VALUE;
|
instruction.kind = VALUE;
|
||||||
instruction.u.string.value = 0x01;
|
|
||||||
|
|
||||||
switch (instruction.type)
|
switch (instruction.type)
|
||||||
{
|
{
|
||||||
@ -1422,6 +1422,71 @@ file_replace (const gchar *filename,
|
|||||||
gssize length,
|
gssize length,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
static void
|
||||||
|
disaster (int status)
|
||||||
|
{
|
||||||
|
const char *error;
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case BZ_PARAM_ERROR:
|
||||||
|
error = "BZ_PARAM_ERROR";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BZ_MEM_ERROR:
|
||||||
|
error = "BZ_MEM_ERROR";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BZ_OUTBUFF_FULL:
|
||||||
|
error = "BZ_OUTBUFF_FULL";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
error = "Unknown error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_error ("Failed to compress file: %s\n", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <bzlib.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
bz2_compress (const guchar *input, int input_length,
|
||||||
|
guchar **output, int *output_length)
|
||||||
|
{
|
||||||
|
size_t compressed_size;
|
||||||
|
guchar *compressed_data;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
g_return_if_fail (input != NULL);
|
||||||
|
|
||||||
|
/* The bzip2 manual says:
|
||||||
|
*
|
||||||
|
* To guarantee that the compressed data will fit in its buffer,
|
||||||
|
* allocate an output buffer of size 1% larger than the uncompressed
|
||||||
|
* data, plus six hundred extra bytes.
|
||||||
|
*/
|
||||||
|
compressed_size = (size_t)(1.02 * input_length + 600);
|
||||||
|
compressed_data = g_malloc (compressed_size);
|
||||||
|
|
||||||
|
status = BZ2_bzBuffToBuffCompress (compressed_data, &compressed_size,
|
||||||
|
(guchar *)input, input_length,
|
||||||
|
9 /* block size */,
|
||||||
|
0 /* verbosity */,
|
||||||
|
0 /* workfactor */);
|
||||||
|
|
||||||
|
if (status != BZ_OK)
|
||||||
|
disaster (status);
|
||||||
|
|
||||||
|
if (output)
|
||||||
|
*output = compressed_data;
|
||||||
|
else
|
||||||
|
g_free (compressed_data);
|
||||||
|
|
||||||
|
if (output_length)
|
||||||
|
*output_length = compressed_size;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
sfile_output_save (SFileOutput *sfile,
|
sfile_output_save (SFileOutput *sfile,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
@ -1432,6 +1497,8 @@ sfile_output_save (SFileOutput *sfile,
|
|||||||
GString *output;
|
GString *output;
|
||||||
int indent;
|
int indent;
|
||||||
gboolean retval;
|
gboolean retval;
|
||||||
|
guchar *compressed;
|
||||||
|
size_t compressed_size;
|
||||||
|
|
||||||
g_return_val_if_fail (sfile != NULL, FALSE);
|
g_return_val_if_fail (sfile != NULL, FALSE);
|
||||||
|
|
||||||
@ -1482,16 +1549,23 @@ sfile_output_save (SFileOutput *sfile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: don't dump this to stdout */
|
#if 0
|
||||||
g_print (output->str);
|
g_print (output->str);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* FIMXE: bz2 compressing the output is probably
|
||||||
|
* interesting at some point. For now just make sure
|
||||||
|
* it works without actually using it.
|
||||||
|
*/
|
||||||
|
bz2_compress (output->str, output->len,
|
||||||
|
&compressed, &compressed_size);
|
||||||
|
|
||||||
|
g_free (compressed);
|
||||||
|
|
||||||
/* FIXME, cut-and-paste the g_file_write() implementation
|
/* FIXME, cut-and-paste the g_file_write() implementation
|
||||||
* as long as it isn't in glib
|
* as long as it isn't in glib
|
||||||
*/
|
*/
|
||||||
retval = file_replace (filename, output->str, - 1, err);
|
retval = file_replace (filename, output->str, - 1, err);
|
||||||
#if 0
|
|
||||||
retval = TRUE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_string_free (output, TRUE);
|
g_string_free (output, TRUE);
|
||||||
|
|
||||||
@ -1514,6 +1588,9 @@ sfile_output_free (SFileOutput *sfile)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* A copy of g_file_replace() because I don't want to depend on
|
/* A copy of g_file_replace() because I don't want to depend on
|
||||||
* GLib HEAD
|
* GLib HEAD
|
||||||
*/
|
*/
|
||||||
@ -1834,3 +1911,4 @@ file_replace (const gchar *filename,
|
|||||||
g_free (tmp_filename);
|
g_free (tmp_filename);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
179
sysprof.c
179
sysprof.c
@ -32,6 +32,8 @@ struct Application
|
|||||||
State state;
|
State state;
|
||||||
StackStash * stash;
|
StackStash * stash;
|
||||||
|
|
||||||
|
GtkWidget * main_window;
|
||||||
|
|
||||||
GtkTreeView * object_view;
|
GtkTreeView * object_view;
|
||||||
GtkTreeView * callers_view;
|
GtkTreeView * callers_view;
|
||||||
GtkTreeView * descendants_view;
|
GtkTreeView * descendants_view;
|
||||||
@ -321,11 +323,12 @@ delete_data (Application *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_start_toggled (GtkToggleToolButton *tool_button, gpointer data)
|
on_start_toggled (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
Application *app = data;
|
Application *app = data;
|
||||||
|
|
||||||
if (!gtk_toggle_tool_button_get_active (tool_button))
|
if (!gtk_toggle_tool_button_get_active (
|
||||||
|
GTK_TOGGLE_TOOL_BUTTON (app->start_button)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
delete_data (app);
|
delete_data (app);
|
||||||
@ -377,7 +380,6 @@ fill_main_list (Application *app)
|
|||||||
G_TYPE_POINTER);
|
G_TYPE_POINTER);
|
||||||
|
|
||||||
objects = profile_get_objects (profile);
|
objects = profile_get_objects (profile);
|
||||||
g_print ("got %d objects\n", g_list_length (objects));
|
|
||||||
for (list = objects; list != NULL; list = list->next)
|
for (list = objects; list != NULL; list = list->next)
|
||||||
{
|
{
|
||||||
ProfileObject *object = list->data;
|
ProfileObject *object = list->data;
|
||||||
@ -412,6 +414,8 @@ fill_main_list (Application *app)
|
|||||||
|
|
||||||
g_object_unref (G_OBJECT (list_store));
|
g_object_unref (G_OBJECT (list_store));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_tree_view_columns_autosize (app->object_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -427,21 +431,15 @@ ensure_profile (Application *app)
|
|||||||
|
|
||||||
app->state = DISPLAYING;
|
app->state = DISPLAYING;
|
||||||
|
|
||||||
#if 0
|
|
||||||
gtk_tree_view_columns_autosize (app->object_view);
|
|
||||||
gtk_tree_view_columns_autosize (app->callers_view);
|
|
||||||
gtk_tree_view_columns_autosize (app->descendants_view);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
update_sensitivity (app);
|
update_sensitivity (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_profile_toggled (gpointer widget, gpointer data)
|
on_profile_toggled (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
Application *app = data;
|
Application *app = data;
|
||||||
|
|
||||||
if (gtk_toggle_tool_button_get_active (widget))
|
if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (app->profile_button)))
|
||||||
{
|
{
|
||||||
if (app->profile && !app->profile_from_file)
|
if (app->profile && !app->profile_from_file)
|
||||||
{
|
{
|
||||||
@ -491,39 +489,137 @@ on_reset_clicked (gpointer widget, gpointer data)
|
|||||||
update_sensitivity (app);
|
update_sensitivity (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
overwrite_file (GtkWindow *window,
|
||||||
|
const char *filename)
|
||||||
|
{
|
||||||
|
GtkWidget *msgbox;
|
||||||
|
gchar *utf8_file_name;
|
||||||
|
AtkObject *obj;
|
||||||
|
gint ret;
|
||||||
|
|
||||||
|
utf8_file_name = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
|
||||||
|
msgbox = gtk_message_dialog_new (window,
|
||||||
|
(GtkDialogFlags)GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
GTK_MESSAGE_QUESTION,
|
||||||
|
GTK_BUTTONS_NONE,
|
||||||
|
_("A file named \"%s\" already exists."),
|
||||||
|
utf8_file_name);
|
||||||
|
g_free (utf8_file_name);
|
||||||
|
|
||||||
|
gtk_message_dialog_format_secondary_text (
|
||||||
|
GTK_MESSAGE_DIALOG (msgbox),
|
||||||
|
_("Do you want to replace it with the one you are saving?"));
|
||||||
|
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (msgbox),
|
||||||
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||||
|
|
||||||
|
gtk_dialog_add_button (GTK_DIALOG (msgbox),
|
||||||
|
_("_Replace"), GTK_RESPONSE_YES);
|
||||||
|
|
||||||
|
gtk_dialog_set_default_response (GTK_DIALOG (msgbox),
|
||||||
|
GTK_RESPONSE_CANCEL);
|
||||||
|
|
||||||
|
obj = gtk_widget_get_accessible (msgbox);
|
||||||
|
|
||||||
|
if (GTK_IS_ACCESSIBLE (obj))
|
||||||
|
atk_object_set_name (obj, _("Question"));
|
||||||
|
|
||||||
|
ret = gtk_dialog_run (GTK_DIALOG (msgbox));
|
||||||
|
gtk_widget_destroy (msgbox);
|
||||||
|
|
||||||
|
return (ret == GTK_RESPONSE_YES);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_save_as_clicked (gpointer widget, gpointer data)
|
on_save_as_clicked (gpointer widget, gpointer data)
|
||||||
{
|
{
|
||||||
GError *err = NULL;
|
|
||||||
Application *app = data;
|
Application *app = data;
|
||||||
|
GtkWidget *dialog;
|
||||||
|
|
||||||
ensure_profile (app);
|
ensure_profile (app);
|
||||||
|
|
||||||
/* FIXME */
|
dialog = gtk_file_chooser_dialog_new ("Save As",
|
||||||
if (!profile_save (app->profile, "name.profile", &err))
|
GTK_WINDOW (app->main_window),
|
||||||
sorry (NULL, "Couldn't save: %s\n", err->message);
|
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||||
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
||||||
|
NULL);
|
||||||
|
|
||||||
#if 0
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||||
sorry (NULL, "Saving profiles is not yet implemented.");
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (app)
|
retry:
|
||||||
;
|
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||||
/* FIXME */
|
{
|
||||||
|
GError *err = NULL;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
|
|
||||||
|
if (g_file_test (filename, G_FILE_TEST_EXISTS) &&
|
||||||
|
!overwrite_file (GTK_WINDOW (app->main_window), filename))
|
||||||
|
{
|
||||||
|
g_free (filename);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!profile_save (app->profile, filename, &err))
|
||||||
|
{
|
||||||
|
sorry (app->main_window, "Could not save %s: %s",
|
||||||
|
filename, err->message);
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_destroy (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_open_clicked (gpointer widget, gpointer data)
|
on_open_clicked (gpointer widget, gpointer data)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
sorry (NULL, "Open is not implemented yet. (Fortunately, neither is saving),");
|
|
||||||
#endif
|
|
||||||
Application *app = data;
|
Application *app = data;
|
||||||
GError *err = NULL;
|
Profile *profile = NULL;
|
||||||
Profile *profile = profile_load ("name.profile", &err);
|
GtkWidget *dialog;
|
||||||
if (!profile)
|
|
||||||
sorry (NULL, "Could not open: %s\n", err->message);
|
dialog = gtk_file_chooser_dialog_new ("Open",
|
||||||
else
|
GTK_WINDOW (app->main_window),
|
||||||
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
|
retry:
|
||||||
|
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||||
|
{
|
||||||
|
GError *err = NULL;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
|
profile = profile_load (filename, &err);
|
||||||
|
|
||||||
|
if (!profile)
|
||||||
|
{
|
||||||
|
sorry (app->main_window, "Could not open %s: %s",
|
||||||
|
filename, err->message);
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_destroy (dialog);
|
||||||
|
|
||||||
|
if (profile)
|
||||||
{
|
{
|
||||||
delete_data (app);
|
delete_data (app);
|
||||||
|
|
||||||
@ -637,6 +733,8 @@ fill_descendants_tree (Application *app)
|
|||||||
{
|
{
|
||||||
restore_sort_state (app->descendants_view, sort_state);
|
restore_sort_state (app->descendants_view, sort_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_tree_view_columns_autosize (app->descendants_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -714,6 +812,8 @@ fill_callers_list (Application *app)
|
|||||||
{
|
{
|
||||||
restore_sort_state (app->callers_view, sort_state);
|
restore_sort_state (app->callers_view, sort_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_tree_view_columns_autosize (app->callers_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -842,20 +942,17 @@ static void
|
|||||||
build_gui (Application *app)
|
build_gui (Application *app)
|
||||||
{
|
{
|
||||||
GladeXML *xml;
|
GladeXML *xml;
|
||||||
GtkWidget *main_window;
|
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeViewColumn *col;
|
GtkTreeViewColumn *col;
|
||||||
|
|
||||||
xml = glade_xml_new ("./sysprof.glade", NULL, NULL);
|
xml = glade_xml_new ("./sysprof.glade", NULL, NULL);
|
||||||
|
|
||||||
/* Main Window */
|
/* Main Window */
|
||||||
main_window = glade_xml_get_widget (xml, "main_window");
|
app->main_window = glade_xml_get_widget (xml, "main_window");
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (main_window), "delete_event",
|
g_signal_connect (G_OBJECT (app->main_window), "delete_event",
|
||||||
G_CALLBACK (on_delete), NULL);
|
G_CALLBACK (on_delete), NULL);
|
||||||
|
|
||||||
gtk_widget_show_all (main_window);
|
|
||||||
|
|
||||||
/* Menu items */
|
/* Menu items */
|
||||||
app->start_item = glade_xml_get_widget (xml, "start_item");
|
app->start_item = glade_xml_get_widget (xml, "start_item");
|
||||||
app->profile_item = glade_xml_get_widget (xml, "profile_item");
|
app->profile_item = glade_xml_get_widget (xml, "profile_item");
|
||||||
@ -891,10 +988,8 @@ build_gui (Application *app)
|
|||||||
app->save_as_button = glade_xml_get_widget (xml, "save_as_button");
|
app->save_as_button = glade_xml_get_widget (xml, "save_as_button");
|
||||||
app->dummy_button = glade_xml_get_widget (xml, "dummy_button");
|
app->dummy_button = glade_xml_get_widget (xml, "dummy_button");
|
||||||
|
|
||||||
gtk_widget_hide (app->dummy_button);
|
gtk_toggle_tool_button_set_active (
|
||||||
|
GTK_TOGGLE_TOOL_BUTTON (app->profile_button), FALSE);
|
||||||
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
|
|
||||||
app->profile_button), FALSE);
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (app->start_button), "toggled",
|
g_signal_connect (G_OBJECT (app->start_button), "toggled",
|
||||||
G_CALLBACK (on_start_toggled), app);
|
G_CALLBACK (on_start_toggled), app);
|
||||||
@ -910,8 +1005,8 @@ build_gui (Application *app)
|
|||||||
|
|
||||||
app->samples_label = glade_xml_get_widget (xml, "samples_label");
|
app->samples_label = glade_xml_get_widget (xml, "samples_label");
|
||||||
|
|
||||||
gtk_widget_realize (GTK_WIDGET (main_window));
|
gtk_widget_realize (GTK_WIDGET (app->main_window));
|
||||||
set_sizes (GTK_WINDOW (main_window),
|
set_sizes (GTK_WINDOW (app->main_window),
|
||||||
glade_xml_get_widget (xml, "hpaned"),
|
glade_xml_get_widget (xml, "hpaned"),
|
||||||
glade_xml_get_widget (xml, "vpaned"));
|
glade_xml_get_widget (xml, "vpaned"));
|
||||||
|
|
||||||
@ -948,6 +1043,10 @@ build_gui (Application *app)
|
|||||||
|
|
||||||
gtk_tree_view_column_set_expand (col, TRUE);
|
gtk_tree_view_column_set_expand (col, TRUE);
|
||||||
|
|
||||||
|
gtk_widget_grab_focus (GTK_WIDGET (app->object_view));
|
||||||
|
gtk_widget_show_all (app->main_window);
|
||||||
|
gtk_widget_hide (app->dummy_button);
|
||||||
|
|
||||||
/* Statusbar */
|
/* Statusbar */
|
||||||
queue_show_samples (app);
|
queue_show_samples (app);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,18 +40,44 @@
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="open_item">
|
<widget class="GtkImageMenuItem" id="open_item">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label">gtk-open</property>
|
<property name="label" translatable="yes">_Open...</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="on_open_activate" last_modification_time="Thu, 04 Nov 2004 21:01:03 GMT"/>
|
<signal name="activate" handler="on_open_item_activate" last_modification_time="Thu, 04 Nov 2004 21:01:03 GMT"/>
|
||||||
|
<accelerator key="o" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||||
|
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="image28">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-open</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="save_as_item">
|
<widget class="GtkImageMenuItem" id="save_as_item">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label">gtk-save-as</property>
|
<property name="label" translatable="yes">Save _As...</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="on_save_as1_activate" last_modification_time="Wed, 31 Dec 2003 20:44:40 GMT"/>
|
<signal name="activate" handler="on_Save _As..._activate" last_modification_time="Wed, 31 Dec 2003 20:44:40 GMT"/>
|
||||||
|
<accelerator key="s" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK" signal="activate"/>
|
||||||
|
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="image29">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-save-as</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
@ -91,7 +117,7 @@
|
|||||||
<signal name="activate" handler="on_start1_activate" last_modification_time="Thu, 04 Nov 2004 18:51:54 GMT"/>
|
<signal name="activate" handler="on_start1_activate" last_modification_time="Thu, 04 Nov 2004 18:51:54 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image10">
|
<widget class="GtkImage" id="image30">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-media-play</property>
|
<property name="stock">gtk-media-play</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -112,7 +138,7 @@
|
|||||||
<signal name="activate" handler="on_profile1_activate" last_modification_time="Thu, 04 Nov 2004 18:51:54 GMT"/>
|
<signal name="activate" handler="on_profile1_activate" last_modification_time="Thu, 04 Nov 2004 18:51:54 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image11">
|
<widget class="GtkImage" id="image31">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-justify-left</property>
|
<property name="stock">gtk-justify-left</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -133,7 +159,7 @@
|
|||||||
<signal name="activate" handler="on_reset_item_activate" last_modification_time="Fri, 05 Nov 2004 15:34:30 GMT"/>
|
<signal name="activate" handler="on_reset_item_activate" last_modification_time="Fri, 05 Nov 2004 15:34:30 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image12">
|
<widget class="GtkImage" id="image32">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-clear</property>
|
<property name="stock">gtk-clear</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user