[gnome-builder] terminal: rename GbTerminal to GbTerminalView



commit 9e0525ffb45fe1c3d3452a004b1c5d50a4b27fa6
Author: Christian Hergert <christian hergert me>
Date:   Tue Jun 9 17:08:04 2015 -0700

    terminal: rename GbTerminal to GbTerminalView
    
    This matches closer to the fact the widget is a GbView.

 plugins/terminal/Makefile.am                       |    4 +-
 .../terminal/{gb-terminal.c => gb-terminal-view.c} |   82 ++++++++++----------
 .../terminal/{gb-terminal.h => gb-terminal-view.h} |   14 ++--
 .../{gb-terminal.ui => gb-terminal-view.ui}        |    3 +-
 plugins/terminal/gb-terminal-workbench-addin.c     |   14 ++--
 plugins/terminal/gb-terminal-workbench-addin.h     |    6 +-
 plugins/terminal/gb-terminal.gresource.xml         |    2 +-
 7 files changed, 62 insertions(+), 63 deletions(-)
---
diff --git a/plugins/terminal/Makefile.am b/plugins/terminal/Makefile.am
index 08406a4..ac791d3 100644
--- a/plugins/terminal/Makefile.am
+++ b/plugins/terminal/Makefile.am
@@ -6,11 +6,11 @@ EXTRA_DIST =
 noinst_LTLIBRARIES = libterminal.la
 
 libterminal_la_SOURCES = \
-       gb-terminal.c \
-       gb-terminal.h \
        gb-terminal-application-addin.c \
        gb-terminal-application-addin.h \
        gb-terminal-plugin.c \
+       gb-terminal-view.c \
+       gb-terminal-view.h \
        gb-terminal-workbench-addin.c \
        gb-terminal-workbench-addin.h \
        $(NULL)
diff --git a/plugins/terminal/gb-terminal.c b/plugins/terminal/gb-terminal-view.c
similarity index 78%
rename from plugins/terminal/gb-terminal.c
rename to plugins/terminal/gb-terminal-view.c
index b26fb97..0cce4ce 100644
--- a/plugins/terminal/gb-terminal.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -20,12 +20,12 @@
 #include <ide.h>
 #include <vte/vte.h>
 
-#include "gb-terminal.h"
+#include "gb-terminal-view.h"
 #include "gb-view.h"
 #include "gb-widget.h"
 #include "gb-workbench.h"
 
-struct _GbTerminal
+struct _GbTerminalView
 {
   GbView       parent_instance;
 
@@ -34,10 +34,10 @@ struct _GbTerminal
   guint        has_spawned : 1;
 };
 
-G_DEFINE_TYPE (GbTerminal, gb_terminal, GB_TYPE_VIEW)
+G_DEFINE_TYPE (GbTerminalView, gb_terminal_view, GB_TYPE_VIEW)
 
 static void
-gb_terminal_respawn (GbTerminal *self)
+gb_terminal_respawn (GbTerminalView *self)
 {
   g_autoptr(GPtrArray) args = NULL;
   g_autofree gchar *workpath = NULL;
@@ -48,7 +48,7 @@ gb_terminal_respawn (GbTerminal *self)
   GFile *workdir;
   GPid child_pid;
 
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   vte_terminal_reset (self->terminal, TRUE, TRUE);
 
@@ -88,12 +88,12 @@ gb_terminal_respawn (GbTerminal *self)
 }
 
 static void
-child_exited_cb (VteTerminal *terminal,
-                 gint         exit_status,
-                 GbTerminal  *self)
+child_exited_cb (VteTerminal    *terminal,
+                 gint            exit_status,
+                 GbTerminalView *self)
 {
   g_assert (VTE_IS_TERMINAL (terminal));
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   if (!gb_widget_activate_action (GTK_WIDGET (self), "view-stack", "close", NULL))
     {
@@ -105,11 +105,11 @@ child_exited_cb (VteTerminal *terminal,
 static void
 gb_terminal_realize (GtkWidget *widget)
 {
-  GbTerminal *self = (GbTerminal *)widget;
+  GbTerminalView *self = (GbTerminalView *)widget;
 
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
-  GTK_WIDGET_CLASS (gb_terminal_parent_class)->realize (widget);
+  GTK_WIDGET_CLASS (gb_terminal_view_parent_class)->realize (widget);
 
   if (!self->has_spawned)
     {
@@ -119,9 +119,9 @@ gb_terminal_realize (GtkWidget *widget)
 }
 
 static void
-size_allocate_cb (VteTerminal   *terminal,
-                  GtkAllocation *alloc,
-                  GbTerminal    *self)
+size_allocate_cb (VteTerminal    *terminal,
+                  GtkAllocation  *alloc,
+                  GbTerminalView *self)
 {
   glong width;
   glong height;
@@ -130,7 +130,7 @@ size_allocate_cb (VteTerminal   *terminal,
 
   g_assert (VTE_IS_TERMINAL (terminal));
   g_assert (alloc != NULL);
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   if ((alloc->width == 0) || (alloc->height == 0))
     return;
@@ -161,7 +161,7 @@ gb_terminal_get_preferred_width (GtkWidget *widget,
    * widget at it's natural size (which prevents us from getting
    * appropriate size requests.
    */
-  GTK_WIDGET_CLASS (gb_terminal_parent_class)->get_preferred_width (widget, min_width, nat_width);
+  GTK_WIDGET_CLASS (gb_terminal_view_parent_class)->get_preferred_width (widget, min_width, nat_width);
   *nat_width = *min_width;
 }
 
@@ -176,17 +176,17 @@ gb_terminal_get_preferred_height (GtkWidget *widget,
    * widget at it's natural size (which prevents us from getting
    * appropriate size requests.
    */
-  GTK_WIDGET_CLASS (gb_terminal_parent_class)->get_preferred_height (widget, min_height, nat_height);
+  GTK_WIDGET_CLASS (gb_terminal_view_parent_class)->get_preferred_height (widget, min_height, nat_height);
   *nat_height = *min_height;
 }
 
 static void
-gb_terminal_set_needs_attention (GbTerminal *self,
-                                 gboolean    needs_attention)
+gb_terminal_set_needs_attention (GbTerminalView *self,
+                                 gboolean        needs_attention)
 {
   GtkWidget *parent;
 
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   parent = gtk_widget_get_parent (GTK_WIDGET (self));
 
@@ -203,25 +203,25 @@ gb_terminal_set_needs_attention (GbTerminal *self,
 }
 
 static void
-notification_received_cb (VteTerminal *terminal,
-                          const gchar *summary,
-                          const gchar *body,
-                          GbTerminal  *self)
+notification_received_cb (VteTerminal    *terminal,
+                          const gchar    *summary,
+                          const gchar    *body,
+                          GbTerminalView *self)
 {
   g_assert (VTE_IS_TERMINAL (terminal));
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   if (!gtk_widget_has_focus (GTK_WIDGET (terminal)))
     gb_terminal_set_needs_attention (self, TRUE);
 }
 
 static gboolean
-focus_in_event_cb (VteTerminal *terminal,
-                   GdkEvent    *event,
-                   GbTerminal  *self)
+focus_in_event_cb (VteTerminal    *terminal,
+                   GdkEvent       *event,
+                   GbTerminalView *self)
 {
   g_assert (VTE_IS_TERMINAL (terminal));
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   gb_terminal_set_needs_attention (self, FALSE);
 
@@ -231,19 +231,19 @@ focus_in_event_cb (VteTerminal *terminal,
 static const gchar *
 gb_terminal_get_title (GbView *view)
 {
-  GbTerminal *self = (GbTerminal *)view;
+  GbTerminalView *self = (GbTerminalView *)view;
 
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   return vte_terminal_get_window_title (self->terminal);
 }
 
 static void
-window_title_changed_cb (VteTerminal *terminal,
-                         GbTerminal  *self)
+window_title_changed_cb (VteTerminal    *terminal,
+                         GbTerminalView *self)
 {
   g_assert (VTE_IS_TERMINAL (terminal));
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   g_object_notify (G_OBJECT (self), "title");
 }
@@ -251,15 +251,15 @@ window_title_changed_cb (VteTerminal *terminal,
 static void
 gb_terminal_grab_focus (GtkWidget *widget)
 {
-  GbTerminal *self = (GbTerminal *)widget;
+  GbTerminalView *self = (GbTerminalView *)widget;
 
-  g_assert (GB_IS_TERMINAL (self));
+  g_assert (GB_IS_TERMINAL_VIEW (self));
 
   gtk_widget_grab_focus (GTK_WIDGET (self->terminal));
 }
 
 static void
-gb_terminal_class_init (GbTerminalClass *klass)
+gb_terminal_view_class_init (GbTerminalViewClass *klass)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   GbViewClass *view_class = GB_VIEW_CLASS (klass);
@@ -271,14 +271,14 @@ gb_terminal_class_init (GbTerminalClass *klass)
 
   view_class->get_title = gb_terminal_get_title;
 
-  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/plugins/terminal/gb-terminal.ui");
-  gtk_widget_class_bind_template_child (widget_class, GbTerminal, terminal);
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/plugins/terminal/gb-terminal-view.ui");
+  gtk_widget_class_bind_template_child (widget_class, GbTerminalView, terminal);
 
   g_type_ensure (VTE_TYPE_TERMINAL);
 }
 
 static void
-gb_terminal_init (GbTerminal *self)
+gb_terminal_view_init (GbTerminalView *self)
 {
   GQuark quark;
   guint signal_id;
diff --git a/plugins/terminal/gb-terminal.h b/plugins/terminal/gb-terminal-view.h
similarity index 75%
rename from plugins/terminal/gb-terminal.h
rename to plugins/terminal/gb-terminal-view.h
index 78e416d..94c3a8d 100644
--- a/plugins/terminal/gb-terminal.h
+++ b/plugins/terminal/gb-terminal-view.h
@@ -1,4 +1,4 @@
-/* gb-terminal.h
+/* gb-terminal-view.h
  *
  * Copyright (C) 2015 Christian Hergert <christian hergert me>
  *
@@ -16,19 +16,17 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef GB_TERMINAL_H
-#define GB_TERMINAL_H
-
-#include <gtk/gtk.h>
+#ifndef GB_TERMINAL_VIEW_H
+#define GB_TERMINAL_VIEW_H
 
 #include "gb-view.h"
 
 G_BEGIN_DECLS
 
-#define GB_TYPE_TERMINAL (gb_terminal_get_type())
+#define GB_TYPE_TERMINAL_VIEW (gb_terminal_view_get_type())
 
-G_DECLARE_FINAL_TYPE (GbTerminal, gb_terminal, GB, TERMINAL, GbView)
+G_DECLARE_FINAL_TYPE (GbTerminalView, gb_terminal_view, GB, TERMINAL_VIEW, GbView)
 
 G_END_DECLS
 
-#endif /* GB_TERMINAL_H */
+#endif /* GB_TERMINAL_VIEW_H */
diff --git a/plugins/terminal/gb-terminal.ui b/plugins/terminal/gb-terminal-view.ui
similarity index 83%
rename from plugins/terminal/gb-terminal.ui
rename to plugins/terminal/gb-terminal-view.ui
index 43e1604..f14a2a6 100644
--- a/plugins/terminal/gb-terminal.ui
+++ b/plugins/terminal/gb-terminal-view.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.16 -->
-  <template class="GbTerminal" parent="GbView">
+  <template class="GbTerminalView" parent="GbView">
     <property name="visible">true</property>
     <child>
       <object class="GtkBox" id="box">
@@ -9,6 +9,7 @@
         <property name="visible">true</property>
         <child>
           <object class="VteTerminal" id="terminal">
+            <property name="audible-bell">false</property>
             <property name="expand">true</property>
             <property name="visible">true</property>
           </object>
diff --git a/plugins/terminal/gb-terminal-workbench-addin.c b/plugins/terminal/gb-terminal-workbench-addin.c
index abf28da..391619e 100644
--- a/plugins/terminal/gb-terminal-workbench-addin.c
+++ b/plugins/terminal/gb-terminal-workbench-addin.c
@@ -1,4 +1,4 @@
-/* gb-terminal-addin.c
+/* gb-terminal-workbench-addin.c
  *
  * Copyright (C) 2015 Christian Hergert <christian hergert me>
  *
@@ -18,17 +18,17 @@
 
 #include <glib/gi18n.h>
 
-#include "gb-terminal.h"
+#include "gb-terminal-view.h"
 #include "gb-terminal-workbench-addin.h"
 #include "gb-view-grid.h"
 #include "gb-workspace.h"
 
 struct _GbTerminalWorkbenchAddin
 {
-  GObject      parent_instance;
+  GObject         parent_instance;
 
-  GbWorkbench *workbench;
-  GbTerminal  *panel_terminal;
+  GbWorkbench    *workbench;
+  GbTerminalView *panel_terminal;
 };
 
 static void workbench_addin_iface_init (GbWorkbenchAddinInterface *iface);
@@ -58,7 +58,7 @@ new_terminal_activate_cb (GSimpleAction   *action,
   g_assert (GB_IS_TERMINAL_WORKBENCH_ADDIN (self));
 
   grid = gb_workbench_get_view_grid (self->workbench);
-  terminal = g_object_new (GB_TYPE_TERMINAL,
+  terminal = g_object_new (GB_TYPE_TERMINAL_VIEW,
                            "visible", TRUE,
                            NULL);
   stack = gb_view_grid_get_last_focus (GB_VIEW_GRID (grid));
@@ -87,7 +87,7 @@ gb_terminal_workbench_addin_load (GbWorkbenchAddin *addin)
 
   if (self->panel_terminal == NULL)
     {
-      self->panel_terminal = g_object_new (GB_TYPE_TERMINAL,
+      self->panel_terminal = g_object_new (GB_TYPE_TERMINAL_VIEW,
                                            "visible", TRUE,
                                            NULL);
       g_object_add_weak_pointer (G_OBJECT (self->panel_terminal),
diff --git a/plugins/terminal/gb-terminal-workbench-addin.h b/plugins/terminal/gb-terminal-workbench-addin.h
index c23b4f4..8d719de 100644
--- a/plugins/terminal/gb-terminal-workbench-addin.h
+++ b/plugins/terminal/gb-terminal-workbench-addin.h
@@ -16,8 +16,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef GB_TERMINAL_ADDIN_H
-#define GB_TERMINAL_ADDIN_H
+#ifndef GB_TERMINAL_WORKBENCH_ADDIN_H
+#define GB_TERMINAL_WORKBENCH_ADDIN_H
 
 #include "gb-workbench-addin.h"
 
@@ -31,4 +31,4 @@ G_DECLARE_FINAL_TYPE (GbTerminalWorkbenchAddin, gb_terminal_workbench_addin,
 
 G_END_DECLS
 
-#endif /* GB_TERMINAL_ADDIN_H */
+#endif /* GB_TERMINAL_WORKBENCH_ADDIN_H */
diff --git a/plugins/terminal/gb-terminal.gresource.xml b/plugins/terminal/gb-terminal.gresource.xml
index 3cf8a00..28b0ab9 100644
--- a/plugins/terminal/gb-terminal.gresource.xml
+++ b/plugins/terminal/gb-terminal.gresource.xml
@@ -2,6 +2,6 @@
 <gresources>
   <gresource prefix="/org/gnome/builder/plugins/terminal">
     <file>gb-terminal.plugin</file>
-    <file>gb-terminal.ui</file>
+    <file>gb-terminal-view.ui</file>
   </gresource>
 </gresources>


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