use status bar widget
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 23 Apr 2014 09:09:18 +0000 (11:09 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 23 Apr 2014 09:09:18 +0000 (11:09 +0200)
src/glade/prss.glade
src/main.c
src/webbrowser.c
src/webbrowser.h

index 692364e..6a54197 100644 (file)
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkBox" id="box4">
+                      <object class="GtkScrolledWindow" id="webkit_window">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
-                        <child>
-                          <object class="GtkScrolledWindow" id="webkit_window">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="shadow_type">in</property>
-                            <child>
-                              <placeholder/>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
+                        <property name="can_focus">True</property>
+                        <property name="shadow_type">in</property>
                         <child>
-                          <object class="GtkLabel" id="browser_status">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">False</property>
-                            <property name="halign">start</property>
-                            <property name="valign">end</property>
-                            <property name="margin_left">4</property>
-                            <property name="margin_top">4</property>
-                            <property name="single_line_mode">True</property>
-                            <property name="angle">0.040000000000000001</property>
-                            <property name="lines">1</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="pack_type">end</property>
-                            <property name="position">1</property>
-                          </packing>
+                          <placeholder/>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">True</property>
                         <property name="fill">True</property>
-                        <property name="position">3</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                   <packing>
                     <property name="resize">True</property>
             <property name="position">2</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkStatusbar" id="statusbar">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">10</property>
+            <property name="margin_right">10</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">6</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">2</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
       </object>
     </child>
   </object>
index d9182d3..0717ce9 100644 (file)
@@ -604,8 +604,8 @@ int main(int argc, char **argv)
 
        panh = GTK_WIDGET(gtk_builder_get_object(builder, "webkit_window"));
 
-       webbrowser_init(GTK_LABEL(gtk_builder_get_object(builder,
-                                                        "browser_status")));
+       webbrowser_init(GTK_STATUSBAR(gtk_builder_get_object
+                                     (builder, "statusbar")));
 
        gtk_container_add(GTK_CONTAINER(panh), web_get_widget());
 
index ebbfce1..4f77fed 100644 (file)
@@ -22,7 +22,7 @@
 #include "webbrowser.h"
 
 static WebKitWebView *view;
-static GtkLabel *w_status;
+static GtkStatusbar *w_status;
 
 static gboolean new_window_requested_cbk(WebKitWebView *view,
                                         WebKitWebFrame *frame,
@@ -42,10 +42,14 @@ static void hovering_over_link_cbk(WebKitWebView *web_view,
                                   gchar *uri,
                                   gpointer user_data)
 {
+       guint id;
+
+       id = gtk_statusbar_get_context_id(w_status, "info");
+
        if (uri)
-               gtk_label_set_label(w_status, uri);
+               gtk_statusbar_push(w_status, id, uri);
        else
-               gtk_label_set_label(w_status, "");
+               gtk_statusbar_pop(w_status, id);
 }
 
 GtkWidget *web_get_widget()
@@ -70,7 +74,7 @@ void web_load(const char *str)
        webkit_web_view_load_string(view, str, NULL, "UTF-8", "file://");
 }
 
-void webbrowser_init(GtkLabel *status)
+void webbrowser_init(GtkStatusbar *status)
 {
        w_status = status;
 }
index ae3e21d..f81f14b 100644 (file)
@@ -23,5 +23,5 @@
 
 GtkWidget *web_get_widget();
 void web_load(const char *);
-void webbrowser_init(GtkLabel *);
+void webbrowser_init(GtkStatusbar *);
 #endif