[sysprof/newui: 22/24] Get rid of screenshot window
- From: SÃren Sandmann Pedersen <ssp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/newui: 22/24] Get rid of screenshot window
- Date: Wed, 29 Jun 2011 06:39:43 +0000 (UTC)
commit d48b9e3bdf85f5db5cefdb03026190ae04288eee
Author: SÃren Sandmann Pedersen <sandmann daimi au dk>
Date: Thu Nov 11 06:56:39 2010 -0500
Get rid of screenshot window
collector.c | 3 +-
sysprof.c | 229 +--------------------------------------------------------
sysprof.glade | 157 ---------------------------------------
3 files changed, 6 insertions(+), 383 deletions(-)
---
diff --git a/collector.c b/collector.c
index 9cbedf5..a5901de 100644
--- a/collector.c
+++ b/collector.c
@@ -345,7 +345,8 @@ on_read (gpointer data)
if (collector->callback)
{
- if (collector->n_samples - collector->prev_samples >= N_WAKEUP_EVENTS)
+ if (!collector->prev_samples ||
+ (collector->n_samples - collector->prev_samples >= N_WAKEUP_EVENTS))
{
gboolean first_sample = collector->prev_samples == 0;
diff --git a/sysprof.c b/sysprof.c
index c9b23c4..b913f9f 100644
--- a/sysprof.c
+++ b/sysprof.c
@@ -66,7 +66,6 @@ struct Application
GtkWidget * reset_item;
GtkWidget * save_as_item;
GtkWidget * open_item;
- GtkWidget * screenshot_item;
GtkWidget * about_item;
GtkWidget * quit_item;
@@ -75,19 +74,11 @@ struct Application
GtkWidget * samples_label;
GtkWidget * samples_hbox;
- gboolean screenshot_window_visible;
- GtkWidget * screenshot_textview;
- GtkWidget * screenshot_close_button;
- GtkWidget * screenshot_window;
-
- int timeout_id;
- int update_screenshot_id;
-
char * loaded_profile;
Profile * profile;
-};
-static void update_screenshot_window (Application *app);
+ int timeout_id;
+};
static void
show_samples (Application *app)
@@ -227,14 +218,6 @@ update_sensitivity (Application *app)
gtk_widget_set_sensitive (GTK_WIDGET (app->descendants_view), sensitive_tree_views);
gtk_widget_set_sensitive (GTK_WIDGET (app->samples_hbox), sensitive_samples_hbox);
- if (app->screenshot_window_visible)
- gtk_widget_show (app->screenshot_window);
- else
- gtk_widget_hide (app->screenshot_window);
-
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (app->screenshot_item),
- app->screenshot_window_visible);
-
show_samples (app);
}
@@ -365,7 +348,6 @@ on_start_toggled (GtkWidget *widget, gpointer data)
g_error_free (err);
}
- update_screenshot_window (app);
update_sensitivity (app);
}
@@ -962,160 +944,6 @@ expand_descendants_tree (Application *app, gpointer object)
}
static void
-get_data (GtkTreeView *view,
- GtkTreeIter *iter,
- gchar **name,
- double *self,
- double *cumulative)
-{
- char *dummy1;
- double dummy2;
- double dummy3;
-
- GtkTreeModel *model = gtk_tree_view_get_model (view);
- gtk_tree_model_get (
- model, iter,
- DESCENDANTS_NAME, name? name : &dummy1,
- DESCENDANTS_SELF, self? self : &dummy2,
- DESCENDANTS_CUMULATIVE, cumulative? cumulative : &dummy3,
- -1);
-}
-
-static int
-get_indent (GtkTreePath *path)
-{
- return 2 * (gtk_tree_path_get_depth (path) - 1);
-}
-
-static void
-compute_text_width (GtkTreeView *view,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
-{
- int *width = data;
- char *name;
-
- get_data (view, iter, &name, NULL, NULL);
-
- *width = MAX (g_utf8_strlen (name, -1) + get_indent (path), *width);
-
- g_free (name);
-}
-
-typedef struct
-{
- int max_width;
- GString *text;
-} AddTextInfo;
-
-static void
-set_monospace (GtkWidget *widget)
-{
- PangoFontDescription *desc =
- pango_font_description_from_string ("monospace");
-
- gtk_widget_modify_font (widget, desc);
-
- pango_font_description_free (desc);
-}
-
-static void
-add_text (GtkTreeView *view,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
-{
- AddTextInfo *info = data;
- char *name;
- double self;
- double cumulative;
- int indent;
- int i;
-
- get_data (view, iter, &name, &self, &cumulative);
-
- indent = get_indent (path);
-
- for (i = 0; i < indent; ++i)
- g_string_append_c (info->text, ' ');
-
- g_string_append_printf (info->text, "%-*s %6.2f%% %6.2f%%\n",
- info->max_width - indent, name, self, cumulative);
-
- g_free (name);
-}
-
-static gboolean
-update_screenshot_window_idle (gpointer data)
-{
- Application *app = data;
- GtkTextBuffer *text_buffer;
-
- if (!app->screenshot_window_visible)
- return FALSE;
-
- text_buffer =
- gtk_text_view_get_buffer (GTK_TEXT_VIEW (app->screenshot_textview));
-
- gtk_text_buffer_set_text (text_buffer, "", -1);
-
- app->update_screenshot_id = 0;
-
- if (app->screenshot_window_visible)
- {
- set_busy (app->screenshot_window, FALSE);
- set_busy (app->screenshot_textview, FALSE);
- }
-
- return FALSE;
-}
-
-static void
-update_screenshot_window (Application *app)
-{
- /* We do this in an idle handler to deal with the case where
- * someone presses Shift-RightArrow on the root of a huge
- * profile. This causes a ton of 'expanded' notifications,
- * each of which would cause us to traverse the tree and
- * update the screenshot window.
- */
- if (app->update_screenshot_id)
- g_source_remove (app->update_screenshot_id);
-
- if (app->screenshot_window_visible)
- {
- /* don't swamp the X server with cursor change requests */
- if (!app->update_screenshot_id)
- {
- set_busy (app->screenshot_window, TRUE);
- set_busy (app->screenshot_textview, TRUE);
- }
- }
-
- app->update_screenshot_id = g_idle_add (
- update_screenshot_window_idle, app);
-}
-
-static void
-on_descendants_row_expanded_or_collapsed (GtkTreeView *tree,
- GtkTreeIter *iter,
- GtkTreePath *path,
- Application *app)
-{
- update_screenshot_window (app);
-}
-
-static void
-on_object_selection_changed (GtkTreeSelection *selection,
- gpointer data)
-{
- Application *app = data;
-
- update_screenshot_window (app);
-}
-
-static void
on_descendants_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
@@ -1131,37 +959,7 @@ on_descendants_row_activated (GtkTreeView *tree_view,
}
static void
-on_screenshot_activated (GtkCheckMenuItem *menu_item,
- Application *app)
-{
- app->screenshot_window_visible = gtk_check_menu_item_get_active (menu_item);
-
- update_screenshot_window (app);
-
- update_sensitivity (app);
-}
-
-static void
-on_screenshot_window_delete (GtkWidget *window,
- GdkEvent *event,
- Application *app)
-{
- app->screenshot_window_visible = FALSE;
-
- update_sensitivity (app);
-}
-
-static void
-on_screenshot_close_button_clicked (GtkWidget *widget,
- Application *app)
-{
- app->screenshot_window_visible = FALSE;
-
- update_sensitivity (app);
-}
-
-static void
-set_sizes (GtkWindow *window, GtkWindow *screenshot_window)
+set_sizes (GtkWindow *window)
{
GdkScreen *screen;
int monitor_num;
@@ -1178,11 +976,6 @@ set_sizes (GtkWindow *window, GtkWindow *screenshot_window)
height = 0.9 * monitor.height;
gtk_window_resize (window, width, height);
-
- width = monitor.width * 5 / 8;
- height = monitor.height * 5 / 8;
-
- gtk_window_resize (screenshot_window, width, height);
}
#define GLADE_FILE DATADIR "/sysprof.glade"
@@ -1211,13 +1004,9 @@ gather_widgets (Application *app)
{ &app->reset_item, "reset_item" },
{ &app->open_item, "open_item" },
{ &app->save_as_item, "save_as_item" },
- { &app->screenshot_item, "screenshot_item" },
{ &app->quit_item, "quit" },
{ &app->about_item, "about" },
{ &app->descendants_view, "descendants_view" },
- { &app->screenshot_window, "screenshot_window" },
- { &app->screenshot_textview, "screenshot_textview" },
- { &app->screenshot_close_button, "screenshot_close_button" },
};
GladeXML *xml = glade_xml_new (GLADE_FILE, NULL, NULL);
@@ -1258,15 +1047,9 @@ connect_signals (Application *app)
{ app->reset_item, "activate", on_reset_clicked, app },
{ app->open_item, "activate", on_open_clicked, app },
{ app->save_as_item, "activate", on_save_as_clicked, app },
- { app->screenshot_item, "activate", on_screenshot_activated, app },
{ app->quit_item, "activate", on_delete, NULL },
{ app->about_item, "activate", on_about_activated, app },
- { app->object_selection, "changed", on_object_selection_changed, app },
{ app->descendants_view, "row-activated", on_descendants_row_activated, app },
- { app->descendants_view, "row-expanded", on_descendants_row_expanded_or_collapsed, app },
- { app->descendants_view, "row-collapsed", on_descendants_row_expanded_or_collapsed, app },
- { app->screenshot_window, "delete_event", on_screenshot_window_delete, app },
- { app->screenshot_close_button, "clicked", on_screenshot_close_button_clicked, app },
};
int i;
@@ -1378,16 +1161,12 @@ build_gui (Application *app)
app->object_selection = gtk_tree_view_get_selection (app->descendants_view);
- /* screenshot window */
-
/* set sizes */
- set_sizes (GTK_WINDOW (app->main_window),
- GTK_WINDOW (app->screenshot_window));
+ set_sizes (GTK_WINDOW (app->main_window));
/* hide/show widgets */
gtk_widget_show_all (app->main_window);
gtk_widget_hide (app->dummy_button);
- gtk_widget_hide (app->screenshot_window);
queue_show_samples (app);
diff --git a/sysprof.glade b/sysprof.glade
index 5245901..cacdb87 100644
--- a/sysprof.glade
+++ b/sysprof.glade
@@ -187,30 +187,6 @@
</child>
<child>
- <widget class="GtkMenuItem" id="view1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_View</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="on_view1_activate" last_modification_time="Tue, 08 Nov 2005 04:06:22 GMT"/>
-
- <child>
- <widget class="GtkMenu" id="view1_menu">
-
- <child>
- <widget class="GtkCheckMenuItem" id="screenshot_item">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Screenshot Window</property>
- <property name="use_underline">True</property>
- <property name="active">False</property>
- <signal name="activate" handler="on_screenshot_item_activate" last_modification_time="Tue, 08 Nov 2005 00:40:14 GMT"/>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
<widget class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="label" translatable="yes">_Help</property>
@@ -696,137 +672,4 @@
</child>
</widget>
-<widget class="GtkWindow" id="screenshot_window">
- <property name="title" translatable="yes">Screenshot</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_UTILITY</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkVBox" id="vbox4">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">3</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkTextView" id="screenshot_textview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="overwrite">False</property>
- <property name="accepts_tab">True</property>
- <property name="justification">GTK_JUSTIFY_LEFT</property>
- <property name="wrap_mode">GTK_WRAP_NONE</property>
- <property name="cursor_visible">False</property>
- <property name="pixels_above_lines">0</property>
- <property name="pixels_below_lines">0</property>
- <property name="pixels_inside_wrap">0</property>
- <property name="left_margin">0</property>
- <property name="right_margin">0</property>
- <property name="indent">0</property>
- <property name="text" translatable="yes"></property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Screenshot</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkButton" id="screenshot_close_button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
</glade-interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]