[gnome-system-monitor/wip/procdialog] Added empty process doubleclick dialog



commit c261d58b7f49898546c560ccf7331eb27c98b8a7
Author: Robert Roth <robert roth off gmail com>
Date:   Fri Dec 20 02:00:57 2013 +0200

    Added empty process doubleclick dialog

 src/procproperties.cpp |   31 +++++++++++++++++++++++++++++++
 src/procproperties.h   |    1 +
 src/proctable.cpp      |   21 +++++++++++++++++++++
 3 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index 76fa1e4..d0991c6 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -268,3 +268,34 @@ create_procproperties_dialog (GsmApplication *app)
     gtk_tree_selection_selected_foreach (app->selection, create_single_procproperties_dialog,
                                          app);
 }
+
+void create_simple_procproperties_dialog (GsmApplication *app, ProcInfo* info) 
+{
+  GtkWidget *box, *listbox, *headerbar, *cancel, *kill;
+  cancel = gtk_button_new_with_mnemonic (_("_Cancel"));
+  kill = gtk_button_new_with_mnemonic (_("_Kill"));
+  gtk_style_context_add_class (gtk_widget_get_style_context (kill), "destructive-action");
+  
+  
+  headerbar = gtk_header_bar_new ();
+  gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), info->name);
+  gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar), cancel);
+  gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), kill);
+
+  GtkWidget *window = gtk_dialog_new ();
+  gtk_window_set_application (GTK_WINDOW (window), app->gobj());
+  gtk_window_set_modal (GTK_WINDOW (window), TRUE);
+  //gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (app->main_window));
+  gtk_window_set_title (GTK_WINDOW (window), info->name);
+  //gtk_widget_set_size_request (window, 400, 300);
+  gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
+  gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
+  
+  //box = gtk_box_new ( GTK_ORIENTATION_VERTICAL, 6);
+  //gtk_container_add (GTK_CONTAINER (window), box);
+  
+  //gtk_box_pack_start (GTK_BOX (box), headerbar, FALSE, FALSE, 0);
+  gtk_widget_show_all (window);
+  gtk_dialog_run (GTK_DIALOG (window));
+  
+}
diff --git a/src/procproperties.h b/src/procproperties.h
index 4502deb..6a8d242 100644
--- a/src/procproperties.h
+++ b/src/procproperties.h
@@ -27,5 +27,6 @@
 #include "application.h"
 
 void create_procproperties_dialog (GsmApplication *app);
+void create_simple_procproperties_dialog (GsmApplication *app, ProcInfo* info);
 
 #endif /* _GSM_PROCPROPERTIES_H_ */
diff --git a/src/proctable.cpp b/src/proctable.cpp
index 19dd241..06e9793 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -62,6 +62,7 @@
 #include "settings-keys.h"
 #include "cgroups.h"
 #include "treeview.h"
+#include "procproperties.h"
 
 ProcInfo::UserMap ProcInfo::users;
 ProcInfo::List ProcInfo::all;
@@ -307,6 +308,23 @@ cb_show_whose_processes_changed (GSettings *settings, const gchar *key, gpointer
     proctable_update (app);
 }
 
+static void 
+cb_proctree_double_clicked (GtkTreeView*        tree_view, 
+                            GtkTreePath*        path, 
+                            GtkTreeViewColumn*  column, 
+                            GsmApplication*     app) 
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
+  if (gtk_tree_model_get_iter (model, &iter, path)) {
+    gchar *name;
+    gpointer info;
+    gtk_tree_model_get (model, &iter, COL_NAME, &name, COL_POINTER, &info, -1);
+    create_simple_procproperties_dialog (app, (ProcInfo*)info);
+    g_free (name);
+  }
+}
+
 GtkWidget *
 proctable_new (GsmApplication * const app)
 {
@@ -593,6 +611,9 @@ proctable_new (GsmApplication * const app)
     g_signal_connect (G_OBJECT (model_sort), "sort-column-changed",
                       G_CALLBACK (cb_save_tree_state), app);
 
+    g_signal_connect (G_OBJECT (proctree), "row-activated",
+                      G_CALLBACK (cb_proctree_double_clicked), app);
+                      
     g_signal_connect (app->settings, "changed::" GSM_SETTING_SHOW_DEPENDENCIES,
                       G_CALLBACK (cb_show_dependencies_changed), app);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]