[hotssh] Switch back to GtkNotebook



commit 1647c61927c69ebf2dcc2f4644346daf59d58f64
Author: Colin Walters <walters verbum org>
Date:   Tue Dec 31 09:34:46 2013 -0500

    Switch back to GtkNotebook
    
    I can't edit GtkStack with glade, which makes it too painful to use.

 src/hotssh-tab.c |   27 +++++++++++++++------------
 src/tab.ui       |   29 +++++++++++++----------------
 2 files changed, 28 insertions(+), 28 deletions(-)
---
diff --git a/src/hotssh-tab.c b/src/hotssh-tab.c
index 846b87e..d2eb717 100644
--- a/src/hotssh-tab.c
+++ b/src/hotssh-tab.c
@@ -44,23 +44,24 @@ enum {
 
 struct _HotSshTab
 {
-  GtkStack parent;
+  GtkNotebook parent;
 };
 
 struct _HotSshTabClass
 {
-  GtkStackClass parent_class;
+  GtkNotebookClass parent_class;
 };
 
 typedef struct _HotSshTabPrivate HotSshTabPrivate;
 
-#define HOTSSH_TAB_PAGE_NEW_CONNECTION ("new-connection")
-#define HOTSSH_TAB_PAGE_CONNECTING     ("connecting")
-#define HOTSSH_TAB_PAGE_ERROR          ("error")
-#define HOTSSH_TAB_PAGE_HOSTKEY        ("hostkey")
-#define HOTSSH_TAB_PAGE_PASSWORD       ("password")
-#define HOTSSH_TAB_PAGE_TERMINAL       ("terminal")
-typedef const char * HotSshTabPage;
+typedef enum {
+  HOTSSH_TAB_PAGE_NEW_CONNECTION,
+  HOTSSH_TAB_PAGE_CONNECTING,
+  HOTSSH_TAB_PAGE_ERROR,
+  HOTSSH_TAB_PAGE_HOSTKEY,
+  HOTSSH_TAB_PAGE_PASSWORD,
+  HOTSSH_TAB_PAGE_TERMINAL
+} HotSshTabPage;
 
 struct _HotSshTabPrivate
 {
@@ -109,7 +110,7 @@ struct _HotSshTabPrivate
   GCancellable *cancellable;
 };
 
-G_DEFINE_TYPE_WITH_PRIVATE(HotSshTab, hotssh_tab, GTK_TYPE_STACK);
+G_DEFINE_TYPE_WITH_PRIVATE(HotSshTab, hotssh_tab, GTK_TYPE_NOTEBOOK);
 
 
 static void
@@ -184,14 +185,14 @@ page_transition (HotSshTab        *self,
   if (new_page == priv->active_page)
     return;
 
-  g_debug ("PAGE: %s => %s", priv->active_page, new_page);
+  g_debug ("PAGE: %u => %u", priv->active_page, new_page);
   priv->active_page = new_page;
 
   if (priv->active_page == HOTSSH_TAB_PAGE_NEW_CONNECTION
       || priv->active_page == HOTSSH_TAB_PAGE_ERROR)
     state_reset_for_new_connection (self);
 
-  gtk_stack_set_visible_child_name ((GtkStack*)self, new_page);
+  gtk_notebook_set_current_page ((GtkNotebook*)self, new_page);
 
   if (priv->active_page == HOTSSH_TAB_PAGE_TERMINAL)
     gtk_widget_grab_focus ((GtkWidget*)priv->terminal);
@@ -807,6 +808,8 @@ hotssh_tab_init (HotSshTab *self)
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
+  gtk_notebook_set_show_tabs ((GtkNotebook*)self, FALSE);
+
   g_signal_connect (priv->connect_button, "clicked", G_CALLBACK (on_connect), self);
   g_signal_connect (priv->connect_cancel_button, "clicked", G_CALLBACK (on_connect_cancel), self);
   g_signal_connect (priv->error_disconnect, "clicked", G_CALLBACK (on_connect_cancel), self);
diff --git a/src/tab.ui b/src/tab.ui
index 1119ca1..04c50b7 100644
--- a/src/tab.ui
+++ b/src/tab.ui
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Sun Nov 17 16:27:47 2013 -->
+<!-- Generated with glade 3.16.0 -->
 <interface>
-  <!-- interface-requires gtk+ 3.10 -->
-  <template class="HotSshTab" parent="GtkStack">
+  <requires lib="gtk+" version="3.10"/>
+  <template class="HotSshTab" parent="GtkNotebook">
     <property name="can_focus">False</property>
     <child>
       <object class="GtkBox" id="content_box">
@@ -123,9 +123,6 @@
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="name">new-connection</property>
-      </packing>
     </child>
     <child>
       <object class="GtkAlignment" id="connection_text_container">
@@ -172,7 +169,7 @@
         </child>
       </object>
       <packing>
-        <property name="name">connecting</property>
+        <property name="position">1</property>
       </packing>
     </child>
     <child>
@@ -239,7 +236,7 @@
         </child>
       </object>
       <packing>
-        <property name="name">error</property>
+        <property name="position">2</property>
       </packing>
     </child>
     <child>
@@ -346,7 +343,7 @@
         </child>
       </object>
       <packing>
-        <property name="name">hostkey</property>
+        <property name="position">3</property>
       </packing>
     </child>
     <child>
@@ -446,7 +443,7 @@
         </child>
       </object>
       <packing>
-        <property name="name">password</property>
+        <property name="position">4</property>
       </packing>
     </child>
     <child>
@@ -471,15 +468,15 @@
         </child>
       </object>
       <packing>
-        <property name="name">terminal</property>
+        <property name="position">5</property>
       </packing>
     </child>
   </template>
   <object class="GtkSizeGroup" id="password_entry_submit_size_group">
-      <property name="mode">vertical</property>
-      <widgets>
-        <widget name="password_entry"/>
-        <widget name="password_submit"/>
-      </widgets>
+    <property name="mode">vertical</property>
+    <widgets>
+      <widget name="password_entry"/>
+      <widget name="password_submit"/>
+    </widgets>
   </object>
 </interface>


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