[gnome-terminal] window: Make inspector available



commit 7a3d8e370f312a040544a28525ce149e69243221
Author: Christian Persch <chpe gnome org>
Date:   Thu Jul 3 10:54:47 2014 +0200

    window: Make inspector available
    
    Disable the keybinding (since we must pass it to the terminal application),
    and add a menu entry instead, when debugging is enabled.

 src/terminal-window.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 84746e5..5960cac 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -120,6 +120,10 @@ struct _TerminalWindowPrivate
 #endif
 #endif
 
+#if defined (ENABLE_DEBUG) && GTK_CHECK_VERSION (3, 13, 4)
+#define ENABLE_INSPECTOR
+#endif
+
 static void terminal_window_dispose     (GObject             *object);
 static void terminal_window_finalize    (GObject             *object);
 static gboolean terminal_window_state_event (GtkWidget            *widget,
@@ -199,6 +203,10 @@ static void help_contents_callback        (GtkAction *action,
                                            TerminalWindow *window);
 static void help_about_callback           (GtkAction *action,
                                            TerminalWindow *window);
+#ifdef ENABLE_INSPECTOR
+static void help_inspector_callback       (GtkAction *action,
+                                           TerminalWindow *window);
+#endif
 
 static gboolean find_larger_zoom_factor  (double  current,
                                           double *found);
@@ -2471,6 +2479,11 @@ terminal_window_init (TerminalWindow *window)
       { "HelpAbout", "help-about", N_("_About"), NULL,
         NULL,
         G_CALLBACK (help_about_callback) },
+#ifdef ENABLE_INSPECTOR
+      { "HelpInspector", NULL, N_("_Inspector"), NULL,
+        NULL,
+        G_CALLBACK (help_inspector_callback) },
+#endif
 
       /* Popup menu */
       { "PopupSendEmail", NULL, N_("_Send Mail To…"), NULL,
@@ -2648,6 +2661,15 @@ terminal_window_init (TerminalWindow *window)
                                                      &error);
   g_assert_no_error (error);
 
+#ifdef ENABLE_INSPECTOR
+  gtk_ui_manager_add_ui (manager, priv->ui_id,
+                         "/menubar/Help", NULL, NULL,
+                         GTK_UI_MANAGER_SEPARATOR, FALSE);
+  gtk_ui_manager_add_ui (manager, priv->ui_id,
+                         "/menubar/Help", "HelpInspector", "HelpInspector",
+                         GTK_UI_MANAGER_MENUITEM, FALSE);
+#endif
+
   priv->menubar = gtk_ui_manager_get_widget (manager, "/menubar");
   gtk_box_pack_start (GTK_BOX (main_vbox),
                      priv->menubar,
@@ -2713,6 +2735,14 @@ terminal_window_class_init (TerminalWindowClass *klass)
   widget_class->screen_changed = terminal_window_screen_changed;
   widget_class->style_updated = terminal_window_style_updated;
 
+#if GTK_CHECK_VERSION (3, 13, 4)
+{
+  GtkWindowClass *window_class = GTK_WINDOW_CLASS (klass);
+
+  window_class->toggle_debugging = NULL;
+}
+#endif
+
   g_type_class_add_private (object_class, sizeof (TerminalWindowPrivate));
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/terminal/ui/window.ui");
@@ -3791,6 +3821,15 @@ help_about_callback (GtkAction *action,
   terminal_util_show_about (NULL);
 }
 
+#ifdef ENABLE_INSPECTOR
+static void
+help_inspector_callback (GtkAction *action,
+                         TerminalWindow *window)
+{
+  gtk_window_set_interactive_debugging (TRUE);
+}
+#endif
+
 GtkUIManager *
 terminal_window_get_ui_manager (TerminalWindow *window)
 {


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