[glabels] Refactored MediaSelect code



commit ab665830afa2c549d3b3d76a5a3f20affcc69f57
Author: Jim Evins <evins snaught com>
Date:   Thu Dec 17 23:21:33 2009 -0500

    Refactored MediaSelect code
    
    - Renamed glWdgtMediaSelect to glMediaSelect
    - Created new glMessageBar widget derived from GtkInfoBar -- API is modelled
      after GtkMessageDialog.  Used this new widget to provide notification
      of empty search results in the 2 glMediaSelect tabs.
    - Simple code formatting changes.

 data/builder/Makefile.am                           |    2 +-
 ...t-media-select.builder => media-select.builder} |   47 ++-
 po/POTFILES.in                                     |    6 +-
 src/Makefile.am                                    |    6 +-
 src/{wdgt-media-select.c => media-select.c}        |  369 +++++++++++---------
 src/media-select.h                                 |   87 +++++
 src/message-bar.c                                  |  248 +++++++++++++
 src/message-bar.h                                  |   87 +++++
 src/new-label-dialog.c                             |   36 +-
 src/wdgt-media-select.h                            |   85 -----
 10 files changed, 682 insertions(+), 291 deletions(-)
---
diff --git a/data/builder/Makefile.am b/data/builder/Makefile.am
index 9279a65..970e28f 100644
--- a/data/builder/Makefile.am
+++ b/data/builder/Makefile.am
@@ -5,7 +5,7 @@ builderdir = $(datadir)/glabels/builder/
 builder_DATA = \
 	property-bar.builder		\
 	print-op-dialog-custom-widget.builder	\
-	wdgt-media-select.builder	\
+	media-select.builder		\
 	merge-properties-dialog.builder	\
 	template-designer.builder	\
 	prefs-dialog.builder		\
diff --git a/data/builder/wdgt-media-select.builder b/data/builder/media-select.builder
similarity index 84%
rename from data/builder/wdgt-media-select.builder
rename to data/builder/media-select.builder
index 80ab2f1..707057a 100644
--- a/data/builder/wdgt-media-select.builder
+++ b/data/builder/media-select.builder
@@ -6,7 +6,7 @@
     <property name="visible">True</property>
     <property name="title" translatable="yes">window1</property>
     <child>
-      <object class="GtkHBox" id="wdgt_media_select_hbox">
+      <object class="GtkHBox" id="media_select_hbox">
         <property name="visible">True</property>
         <child>
           <object class="GtkNotebook" id="notebook">
@@ -14,14 +14,28 @@
             <property name="border_width">12</property>
             <child>
               <object class="GtkVBox" id="recent_tab_vbox">
+                <property name="height_request">320</property>
                 <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkVBox" id="recent_info_vbox">
+                    <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
                 <child>
                   <object class="GtkScrolledWindow" id="scrolledwindow2">
-                    <property name="width_request">480</property>
-                    <property name="height_request">320</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="border_width">12</property>
                     <property name="hscrollbar_policy">automatic</property>
                     <property name="vscrollbar_policy">automatic</property>
                     <property name="shadow_type">in</property>
@@ -33,7 +47,7 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="position">0</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
@@ -50,10 +64,11 @@
             <child>
               <object class="GtkVBox" id="search_all_tab_vbox">
                 <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkHBox" id="hbox6">
                     <property name="visible">True</property>
-                    <property name="border_width">12</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkHBox" id="hbox9">
@@ -152,16 +167,28 @@
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="padding">6</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkVBox" id="search_all_info_vbox">
+                    <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkScrolledWindow" id="scrolledwindow1">
-                    <property name="width_request">480</property>
-                    <property name="height_request">320</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="border_width">12</property>
                     <property name="hscrollbar_policy">automatic</property>
                     <property name="vscrollbar_policy">automatic</property>
                     <property name="shadow_type">in</property>
@@ -173,7 +200,7 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="position">1</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </object>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4f6bb28..ba80596 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -81,6 +81,8 @@ src/label-text.c
 src/label-text.h
 #src/marshal.c
 #src/marshal.h
+src/media-select.c
+src/media-select.h
 src/merge.c
 src/merge.h
 src/merge-evolution.c
@@ -131,6 +133,8 @@ src/print-op.c
 src/print-op-dialog.c
 src/print-op-dialog.h
 src/print-op.h
+src/message-bar.c
+src/message-bar.h
 src/recent.c
 src/recent.h
 src/rotate-label-button.c
@@ -177,8 +181,6 @@ src/warning-handler.c
 src/warning-handler.h
 src/wdgt-chain-button.c
 src/wdgt-chain-button.h
-src/wdgt-media-select.c
-src/wdgt-media-select.h
 src/window.c
 src/window.h
 src/xml-label-04.c
diff --git a/src/Makefile.am b/src/Makefile.am
index fe1c337..401ae62 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -163,8 +163,10 @@ glabels_SOURCES = 			\
 	mini-preview-pixbuf.h		\
 	mini-preview-pixbuf-cache.c	\
 	mini-preview-pixbuf-cache.h	\
-	wdgt-media-select.c		\
-	wdgt-media-select.h		\
+	media-select.c			\
+	media-select.h			\
+	message-bar.c			\
+	message-bar.h			\
 	template-history.c		\
 	template-history.h		\
 	template-history-model.c	\
diff --git a/src/wdgt-media-select.c b/src/media-select.c
similarity index 69%
rename from src/wdgt-media-select.c
rename to src/media-select.c
index 0cf1adf..5f1eecd 100644
--- a/src/wdgt-media-select.c
+++ b/src/media-select.c
@@ -1,5 +1,5 @@
 /*
- *  wdgt-media-select.c
+ *  media-select.c
  *  Copyright (C) 2001-2009  Jim Evins <evins snaught com>.
  *
  *  This file is part of gLabels.
@@ -20,7 +20,7 @@
 
 #include <config.h>
 
-#include "wdgt-media-select.h"
+#include "media-select.h"
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
@@ -29,6 +29,7 @@
 #include <libglabels/libglabels.h>
 #include "mini-preview-pixbuf-cache.h"
 #include "prefs.h"
+#include "message-bar.h"
 #include "template-history.h"
 #include "str-util.h"
 #include "combo-util.h"
@@ -54,7 +55,7 @@ enum {
 	N_COLUMNS
 };
 
-struct _glWdgtMediaSelectPrivate {
+struct _glMediaSelectPrivate {
 
         GtkBuilder   *builder;
 
@@ -63,11 +64,15 @@ struct _glWdgtMediaSelectPrivate {
 
         gint          recent_page_num;
         GtkWidget    *recent_tab_vbox;
+        GtkWidget    *recent_info_vbox;
+        GtkWidget    *recent_info_bar;
         GtkWidget    *recent_treeview;
         GtkListStore *recent_store;
 
         gint          search_all_page_num;
         GtkWidget    *search_all_tab_vbox;
+        GtkWidget    *search_all_info_vbox;
+        GtkWidget    *search_all_info_bar;
         GtkWidget    *brand_combo;
         GtkWidget    *page_size_combo;
         GtkWidget    *category_combo;
@@ -83,65 +88,70 @@ enum {
         LAST_SIGNAL
 };
 
-typedef void (*glWdgtMediaSelectSignal) (GObject * object, gpointer data);
-
 
 /*===========================================*/
 /* Private globals                           */
 /*===========================================*/
 
-static gint wdgt_media_select_signals[LAST_SIGNAL] = { 0 };
+static gint media_select_signals[LAST_SIGNAL] = { 0 };
 
 
 /*===========================================*/
 /* Local function prototypes                 */
 /*===========================================*/
 
-static void gl_wdgt_media_select_finalize      (GObject                *object);
+static void   gl_media_select_finalize   (GObject                *object);
+
+static void   gl_media_select_construct  (glMediaSelect          *this);
+
+static void   filter_changed_cb          (GtkComboBox            *combo,
+                                          gpointer                user_data);
+
+static void   selection_changed_cb       (GtkTreeSelection       *selection,
+                                          gpointer                user_data);
 
-static void gl_wdgt_media_select_construct     (glWdgtMediaSelect      *media_select);
+static void   page_changed_cb            (GtkNotebook            *notebook,
+                                          GtkNotebookPage        *page,
+                                          guint                   page_num,
+                                          gpointer                user_data);
 
-static void filter_changed_cb                  (GtkComboBox            *combo,
-                                                gpointer                user_data);
-static void selection_changed_cb               (GtkTreeSelection       *selection,
-                                                gpointer                user_data);
-static void page_changed_cb                    (GtkNotebook            *notebook,
-                                                GtkNotebookPage        *page,
-                                                guint                   page_num,
-                                                gpointer                user_data);
+static gchar *get_layout_desc            (const lglTemplate      *template);
 
-static gchar *get_layout_desc                  (const lglTemplate      *template);
-static gchar *get_label_size_desc              (const lglTemplate      *template);
-static void   load_recent_list                 (GtkListStore           *store,
-                                                GtkTreeSelection       *selection,
-                                                GList                  *list);
-static void   load_search_all_list             (GtkListStore           *store,
-                                                GtkTreeSelection       *selection,
-                                                GList                  *list);
+static gchar *get_label_size_desc        (const lglTemplate      *template);
+
+static void   load_recent_list           (glMediaSelect          *this,
+                                          GtkListStore           *store,
+                                          GtkTreeSelection       *selection,
+                                          GList                  *list);
+
+static void   load_search_all_list       (glMediaSelect          *this,
+                                          GtkListStore           *store,
+                                          GtkTreeSelection       *selection,
+                                          GList                  *list);
 
 
 /****************************************************************************/
 /* Boilerplate Object stuff.                                                */
 /****************************************************************************/
-G_DEFINE_TYPE (glWdgtMediaSelect, gl_wdgt_media_select, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (glMediaSelect, gl_media_select, GTK_TYPE_VBOX);
 
 
 static void
-gl_wdgt_media_select_class_init (glWdgtMediaSelectClass *class)
+gl_media_select_class_init (glMediaSelectClass *class)
 {
         GObjectClass *object_class = G_OBJECT_CLASS (class);
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-        gl_wdgt_media_select_parent_class = g_type_class_peek_parent (class);
+        gl_media_select_parent_class = g_type_class_peek_parent (class);
 
-        object_class->finalize = gl_wdgt_media_select_finalize;
+        object_class->finalize = gl_media_select_finalize;
 
-        wdgt_media_select_signals[CHANGED] =
+        media_select_signals[CHANGED] =
             g_signal_new ("changed",
                           G_OBJECT_CLASS_TYPE(object_class),
                           G_SIGNAL_RUN_LAST,
-                          G_STRUCT_OFFSET (glWdgtMediaSelectClass, changed),
+                          G_STRUCT_OFFSET (glMediaSelectClass, changed),
                           NULL, NULL,
                           gl_marshal_VOID__VOID,
                           G_TYPE_NONE, 0);
@@ -151,54 +161,54 @@ gl_wdgt_media_select_class_init (glWdgtMediaSelectClass *class)
 
 
 static void
-gl_wdgt_media_select_init (glWdgtMediaSelect *media_select)
+gl_media_select_init (glMediaSelect *this)
 {
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-        media_select->priv = g_new0 (glWdgtMediaSelectPrivate, 1);
+        this->priv = g_new0 (glMediaSelectPrivate, 1);
 
         gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 
 static void
-gl_wdgt_media_select_finalize (GObject *object)
+gl_media_select_finalize (GObject *object)
 {
-        glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (object);
+        glMediaSelect *this = GL_MEDIA_SELECT (object);
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
         g_return_if_fail (object != NULL);
-        g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object));
+        g_return_if_fail (GL_IS_MEDIA_SELECT (object));
 
-        if (media_select->priv->builder)
+        if (this->priv->builder)
         {
-                g_object_unref (media_select->priv->builder);
+                g_object_unref (this->priv->builder);
         }
-        g_object_unref (media_select->priv->recent_store);
-        g_object_unref (media_select->priv->search_all_store);
-        g_free (media_select->priv);
+        g_object_unref (this->priv->recent_store);
+        g_object_unref (this->priv->search_all_store);
+        g_free (this->priv);
 
-        G_OBJECT_CLASS (gl_wdgt_media_select_parent_class)->finalize (object);
+        G_OBJECT_CLASS (gl_media_select_parent_class)->finalize (object);
 
         gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 
 GtkWidget *
-gl_wdgt_media_select_new (void)
+gl_media_select_new (void)
 {
-        glWdgtMediaSelect *media_select;
+        glMediaSelect *this;
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-        media_select = g_object_new (gl_wdgt_media_select_get_type (), NULL);
+        this = g_object_new (gl_media_select_get_type (), NULL);
 
-        gl_wdgt_media_select_construct (media_select);
+        gl_media_select_construct (this);
 
         gl_debug (DEBUG_MEDIA_SELECT, "END");
 
-        return GTK_WIDGET (media_select);
+        return GTK_WIDGET (this);
 }
 
 
@@ -206,10 +216,10 @@ gl_wdgt_media_select_new (void)
 /* PRIVATE.  Construct composite widget.                                    */
 /*--------------------------------------------------------------------------*/
 static void
-gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
+gl_media_select_construct (glMediaSelect *this)
 {
         GtkBuilder        *builder;
-        static gchar      *object_ids[] = { "wdgt_media_select_hbox", NULL };
+        static gchar      *object_ids[] = { "media_select_hbox", NULL };
         GError            *error = NULL;
         GtkWidget         *hbox;
         GList             *recent_list = NULL;
@@ -226,12 +236,12 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-        g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (media_select));
-        g_return_if_fail (media_select->priv != NULL);
+        g_return_if_fail (GL_IS_MEDIA_SELECT (this));
+        g_return_if_fail (this->priv != NULL);
 
         builder = gtk_builder_new ();
         gtk_builder_add_objects_from_file (builder,
-                                           GLABELS_BUILDER_DIR "wdgt-media-select.builder",
+                                           GLABELS_BUILDER_DIR "media-select.builder",
                                            object_ids,
                                            &error);
 	if (error) {
@@ -241,33 +251,35 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
 	}
 
         gl_builder_util_get_widgets (builder,
-                                     "wdgt_media_select_hbox", &hbox,
-                                     "notebook",               &media_select->priv->notebook,
-
-                                     "recent_tab_vbox",        &media_select->priv->recent_tab_vbox,
-
-                                     "recent_treeview",        &media_select->priv->recent_treeview,
-                                     "search_all_tab_vbox",    &media_select->priv->search_all_tab_vbox,
-                                     "brand_combo",            &media_select->priv->brand_combo,
-                                     "page_size_combo",        &media_select->priv->page_size_combo,
-                                     "category_combo",         &media_select->priv->category_combo,
-                                     "search_all_treeview",    &media_select->priv->search_all_treeview,
+                                     "media_select_hbox",      &hbox,
+                                     "notebook",               &this->priv->notebook,
+                                     "recent_tab_vbox",        &this->priv->recent_tab_vbox,
+                                     "recent_info_vbox",       &this->priv->recent_info_vbox,
+                                     "recent_treeview",        &this->priv->recent_treeview,
+                                     "search_all_tab_vbox",    &this->priv->search_all_tab_vbox,
+                                     "brand_combo",            &this->priv->brand_combo,
+                                     "page_size_combo",        &this->priv->page_size_combo,
+                                     "category_combo",         &this->priv->category_combo,
+                                     "search_all_info_vbox",   &this->priv->search_all_info_vbox,
+                                     "search_all_treeview",    &this->priv->search_all_treeview,
                                      NULL);
 
-        gtk_container_add (GTK_CONTAINER (media_select), hbox);
-        media_select->priv->builder = builder;
+        gtk_container_add (GTK_CONTAINER (this), hbox);
+        this->priv->builder = builder;
+
+        this->priv->recent_page_num =
+                gtk_notebook_page_num (GTK_NOTEBOOK (this->priv->notebook),
+                                       this->priv->recent_tab_vbox);
+        this->priv->search_all_page_num =
+                gtk_notebook_page_num (GTK_NOTEBOOK (this->priv->notebook),
+                                       this->priv->search_all_tab_vbox);
 
-        media_select->priv->recent_page_num =
-                gtk_notebook_page_num (GTK_NOTEBOOK (media_select->priv->notebook),
-                                       media_select->priv->recent_tab_vbox);
-        media_select->priv->search_all_page_num =
-                gtk_notebook_page_num (GTK_NOTEBOOK (media_select->priv->notebook),
-                                       media_select->priv->search_all_tab_vbox);
+        gtk_widget_show_all (GTK_WIDGET (this));
 
         /* Recent templates treeview */
-        media_select->priv->recent_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
-        gtk_tree_view_set_model (GTK_TREE_VIEW (media_select->priv->recent_treeview),
-                                 GTK_TREE_MODEL (media_select->priv->recent_store));
+        this->priv->recent_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
+        gtk_tree_view_set_model (GTK_TREE_VIEW (this->priv->recent_treeview),
+                                 GTK_TREE_MODEL (this->priv->recent_store));
         renderer = gtk_cell_renderer_pixbuf_new ();
         column = gtk_tree_view_column_new_with_attributes ("", renderer,
                                                            "pixbuf", PREVIEW_COLUMN,
@@ -275,51 +287,51 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
                                                            "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
                                                            NULL);
         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-        gtk_tree_view_append_column (GTK_TREE_VIEW (media_select->priv->recent_treeview), column);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->recent_treeview), column);
         renderer = gtk_cell_renderer_text_new ();
         column = gtk_tree_view_column_new_with_attributes ("", renderer,
                                                            "markup", DESCRIPTION_COLUMN,
                                                            NULL);
         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-        gtk_tree_view_append_column (GTK_TREE_VIEW (media_select->priv->recent_treeview), column);
-        recent_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->recent_treeview));
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->recent_treeview), column);
+        recent_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->recent_treeview));
         recent_list = gl_template_history_model_get_name_list (gl_template_history);
-        load_recent_list (media_select->priv->recent_store, recent_selection, recent_list);
+        load_recent_list (this, this->priv->recent_store, recent_selection, recent_list);
 
         page_size_id = gl_prefs_model_get_default_page_size (gl_prefs);
         page_size_name = lgl_db_lookup_paper_name_from_id (page_size_id);
 
         /* Brand selection control */
-        gl_combo_util_add_text_model (GTK_COMBO_BOX (media_select->priv->brand_combo));
+        gl_combo_util_add_text_model (GTK_COMBO_BOX (this->priv->brand_combo));
         brands = lgl_db_get_brand_list (NULL, NULL);
         brands = g_list_prepend (brands, g_strdup (_("Any")));
-        gl_combo_util_set_strings (GTK_COMBO_BOX (media_select->priv->brand_combo), brands);
+        gl_combo_util_set_strings (GTK_COMBO_BOX (this->priv->brand_combo), brands);
         lgl_db_free_brand_list (brands);
-        gl_combo_util_set_active_text (GTK_COMBO_BOX (media_select->priv->brand_combo),
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->brand_combo),
                                        _("Any"));
 
         /* Page size selection control */
-        gl_combo_util_add_text_model (GTK_COMBO_BOX (media_select->priv->page_size_combo));
+        gl_combo_util_add_text_model (GTK_COMBO_BOX (this->priv->page_size_combo));
         page_sizes = lgl_db_get_paper_name_list ();
         page_sizes = g_list_prepend (page_sizes, g_strdup (_("Any")));
-        gl_combo_util_set_strings (GTK_COMBO_BOX (media_select->priv->page_size_combo), page_sizes);
+        gl_combo_util_set_strings (GTK_COMBO_BOX (this->priv->page_size_combo), page_sizes);
         lgl_db_free_paper_name_list (page_sizes);
-        gl_combo_util_set_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo),
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->page_size_combo),
                                        page_size_name);
 
         /* Category selection control */
-        gl_combo_util_add_text_model (GTK_COMBO_BOX (media_select->priv->category_combo));
+        gl_combo_util_add_text_model (GTK_COMBO_BOX (this->priv->category_combo));
         categories = lgl_db_get_category_name_list ();
         categories = g_list_prepend (categories, g_strdup (_("Any")));
-        gl_combo_util_set_strings (GTK_COMBO_BOX (media_select->priv->category_combo), categories);
-        gl_combo_util_set_active_text (GTK_COMBO_BOX (media_select->priv->category_combo),
+        gl_combo_util_set_strings (GTK_COMBO_BOX (this->priv->category_combo), categories);
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->category_combo),
                                        _("Any"));
         lgl_db_free_category_name_list (categories);
 
         /* Search all treeview */
-        media_select->priv->search_all_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
-        gtk_tree_view_set_model (GTK_TREE_VIEW (media_select->priv->search_all_treeview),
-                                 GTK_TREE_MODEL (media_select->priv->search_all_store));
+        this->priv->search_all_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
+        gtk_tree_view_set_model (GTK_TREE_VIEW (this->priv->search_all_treeview),
+                                 GTK_TREE_MODEL (this->priv->search_all_store));
         renderer = gtk_cell_renderer_pixbuf_new ();
         column = gtk_tree_view_column_new_with_attributes ("", renderer,
                                                            "pixbuf", PREVIEW_COLUMN,
@@ -327,50 +339,49 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
                                                            "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
                                                            NULL);
         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-        gtk_tree_view_append_column (GTK_TREE_VIEW (media_select->priv->search_all_treeview), column);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->search_all_treeview), column);
         renderer = gtk_cell_renderer_text_new ();
         column = gtk_tree_view_column_new_with_attributes ("", renderer,
                                                            "markup", DESCRIPTION_COLUMN,
                                                            NULL);
         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-        gtk_tree_view_append_column (GTK_TREE_VIEW (media_select->priv->search_all_treeview), column);
-        search_all_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->search_all_treeview));
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->search_all_treeview), column);
+        search_all_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
         search_all_names = lgl_db_get_template_name_list_all (NULL, page_size_id, NULL);
-        load_search_all_list (media_select->priv->search_all_store, search_all_selection, search_all_names);
+        load_search_all_list (this, this->priv->search_all_store, search_all_selection, search_all_names);
         lgl_db_free_template_name_list (search_all_names);
 
         /* Connect signals to controls */
-        g_signal_connect (G_OBJECT (media_select->priv->brand_combo), "changed",
+        g_signal_connect (G_OBJECT (this->priv->brand_combo), "changed",
                           G_CALLBACK (filter_changed_cb),
-                          media_select);
-        g_signal_connect (G_OBJECT (media_select->priv->page_size_combo), "changed",
+                          this);
+        g_signal_connect (G_OBJECT (this->priv->page_size_combo), "changed",
                           G_CALLBACK (filter_changed_cb),
-                          media_select);
-        g_signal_connect (G_OBJECT (media_select->priv->category_combo), "changed",
+                          this);
+        g_signal_connect (G_OBJECT (this->priv->category_combo), "changed",
                           G_CALLBACK (filter_changed_cb),
-                          media_select);
+                          this);
         g_signal_connect (G_OBJECT (recent_selection), "changed",
                           G_CALLBACK (selection_changed_cb),
-                          media_select);
+                          this);
         g_signal_connect (G_OBJECT (search_all_selection), "changed",
                           G_CALLBACK (selection_changed_cb),
-                          media_select);
-        g_signal_connect (G_OBJECT (media_select->priv->notebook), "switch-page",
+                          this);
+        g_signal_connect (G_OBJECT (this->priv->notebook), "switch-page",
                           G_CALLBACK (page_changed_cb),
-                          media_select);
+                          this);
 
         g_free (page_size_name);
 
-        gtk_widget_show_all (GTK_WIDGET (media_select));
         if ( recent_list )
         {
-                gtk_notebook_set_current_page (GTK_NOTEBOOK (media_select->priv->notebook),
-                                               media_select->priv->recent_page_num);
+                gtk_notebook_set_current_page (GTK_NOTEBOOK (this->priv->notebook),
+                                               this->priv->recent_page_num);
         }
         else
         {
-                gtk_notebook_set_current_page (GTK_NOTEBOOK (media_select->priv->notebook),
-                                               media_select->priv->search_all_page_num);
+                gtk_notebook_set_current_page (GTK_NOTEBOOK (this->priv->notebook),
+                                               this->priv->search_all_page_num);
         }
         gl_template_history_model_free_name_list (recent_list);
 
@@ -385,7 +396,7 @@ static void
 filter_changed_cb (GtkComboBox *combo,
                    gpointer     user_data)
 {
-        glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
+        glMediaSelect     *this = GL_MEDIA_SELECT (user_data);
         gchar             *brand;
         gchar             *page_size_name, *page_size_id;
         gchar             *category_name, *category_id;
@@ -395,12 +406,12 @@ filter_changed_cb (GtkComboBox *combo,
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
 
-	media_select->priv->stop_signals = TRUE;
+	this->priv->stop_signals = TRUE;
 
         /* Update template selections for new filter settings */
-        brand = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->brand_combo));
-        page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo));
-        category_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->category_combo));
+        brand = gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->brand_combo));
+        page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->page_size_combo));
+        category_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->category_combo));
         if ( brand && strlen(brand) &&
              page_size_name && strlen(page_size_name) &&
              category_name && strlen(category_name) )
@@ -418,22 +429,22 @@ filter_changed_cb (GtkComboBox *combo,
                 gl_debug (DEBUG_MEDIA_SELECT, "page_size_id = \"%s\"", page_size_id);
                 gl_debug (DEBUG_MEDIA_SELECT, "category_id = \"%s\"", category_id);
                 search_all_names = lgl_db_get_template_name_list_all (brand, page_size_id, category_id);
-                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->search_all_treeview));
-                load_search_all_list (media_select->priv->search_all_store, selection, search_all_names);
+                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
+                load_search_all_list (this, this->priv->search_all_store, selection, search_all_names);
                 lgl_db_free_template_name_list (search_all_names);
                 g_free (page_size_id);
                 g_free (category_id);
 
                 /* Emit our "changed" signal */
                 g_signal_emit (G_OBJECT (user_data),
-                               wdgt_media_select_signals[CHANGED], 0);
+                               media_select_signals[CHANGED], 0);
         }
         g_free (brand);
         g_free (page_size_name);
         g_free (category_name);
 
 
-	media_select->priv->stop_signals = FALSE;
+	this->priv->stop_signals = FALSE;
 
         gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
@@ -446,15 +457,15 @@ static void
 selection_changed_cb (GtkTreeSelection       *selection,
                       gpointer                user_data)
 {
-        glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
+        glMediaSelect *this = GL_MEDIA_SELECT (user_data);
 
-	if (media_select->priv->stop_signals) return;
+	if (this->priv->stop_signals) return;
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
         /* Emit our "changed" signal */
         g_signal_emit (G_OBJECT (user_data),
-                       wdgt_media_select_signals[CHANGED], 0);
+                       media_select_signals[CHANGED], 0);
 
         gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
@@ -469,20 +480,20 @@ page_changed_cb (GtkNotebook            *notebook,
                  guint                   page_num,
                  gpointer                user_data)
 {
-        glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
+        glMediaSelect *this = GL_MEDIA_SELECT (user_data);
 
-	if (media_select->priv->stop_signals) return;
+	if (this->priv->stop_signals) return;
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
         /*
          * Store new current page, because this signal is emitted before the actual page change.
          */
-	media_select->priv->current_page_num = page_num;
+	this->priv->current_page_num = page_num;
 
         /* Emit our "changed" signal */
         g_signal_emit (G_OBJECT (user_data),
-                       wdgt_media_select_signals[CHANGED], 0);
+                       media_select_signals[CHANGED], 0);
 
         gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
@@ -492,7 +503,7 @@ page_changed_cb (GtkNotebook            *notebook,
 /* query selected label template name.                                      */
 /****************************************************************************/
 gchar *
-gl_wdgt_media_select_get_name (glWdgtMediaSelect *media_select)
+gl_media_select_get_name (glMediaSelect *this)
 {
         gint               page_num;
         GtkTreeSelection  *selection;
@@ -502,14 +513,14 @@ gl_wdgt_media_select_get_name (glWdgtMediaSelect *media_select)
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-        page_num = media_select->priv->current_page_num;
-        if (page_num == media_select->priv->recent_page_num)
+        page_num = this->priv->current_page_num;
+        if (page_num == this->priv->recent_page_num)
         {
-                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->recent_treeview));
+                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->recent_treeview));
         }
-        else if (page_num == media_select->priv->search_all_page_num)
+        else if (page_num == this->priv->search_all_page_num)
         {
-                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->search_all_treeview));
+                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
         }
         else
         {
@@ -536,8 +547,8 @@ gl_wdgt_media_select_get_name (glWdgtMediaSelect *media_select)
 /* set selected label template name.                                        */
 /****************************************************************************/
 void
-gl_wdgt_media_select_set_name (glWdgtMediaSelect *media_select,
-                               gchar             *name)
+gl_media_select_set_name (glMediaSelect *this,
+                          gchar         *name)
 {
         GtkTreeSelection  *selection;
         GtkTreeModel      *model;
@@ -548,10 +559,10 @@ gl_wdgt_media_select_set_name (glWdgtMediaSelect *media_select,
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->search_all_treeview));
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
         g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
 
-        model = GTK_TREE_MODEL (media_select->priv->search_all_store);
+        model = GTK_TREE_MODEL (this->priv->search_all_store);
 
         for ( flag = gtk_tree_model_get_iter_first (model, &iter);
               flag;
@@ -562,7 +573,7 @@ gl_wdgt_media_select_set_name (glWdgtMediaSelect *media_select,
                 {
                         gtk_tree_selection_select_iter (selection, &iter);
                         path = gtk_tree_model_get_path (model, &iter);
-                        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (media_select->priv->search_all_treeview),
+                        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (this->priv->search_all_treeview),
                                                       path,
                                                       NULL,
                                                       TRUE, 0.5, 0.0);
@@ -579,9 +590,9 @@ gl_wdgt_media_select_set_name (glWdgtMediaSelect *media_select,
 /* query current filter parameters.                                         */
 /****************************************************************************/
 void
-gl_wdgt_media_select_get_filter_parameters (glWdgtMediaSelect *media_select,
-                                            gchar            **page_size_id,
-                                            gchar            **category_id)
+gl_media_select_get_filter_parameters (glMediaSelect  *this,
+                                       gchar         **page_size_id,
+                                       gchar         **category_id)
 {
         gchar *page_size_name, *category_name;
 
@@ -591,12 +602,12 @@ gl_wdgt_media_select_get_filter_parameters (glWdgtMediaSelect *media_select,
         g_free (*category_id);
 
         page_size_name =
-                gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo));
+                gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->page_size_combo));
 
         *page_size_id = lgl_db_lookup_paper_id_from_name (page_size_name);
 
         category_name =
-                gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->category_combo));
+                gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->category_combo));
 
         *category_id = lgl_db_lookup_category_id_from_name (category_name);
 
@@ -609,9 +620,9 @@ gl_wdgt_media_select_get_filter_parameters (glWdgtMediaSelect *media_select,
 /* set filter parameters.                                                   */
 /****************************************************************************/
 void
-gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select,
-                                            const gchar       *page_size_id,
-                                            const gchar       *category_id)
+gl_media_select_set_filter_parameters (glMediaSelect  *this,
+                                       const gchar    *page_size_id,
+                                       const gchar    *category_id)
 {
         gchar *page_size_name;
         gchar *category_name;
@@ -624,7 +635,7 @@ gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select,
                 page_size_name = g_strdup (_("Any"));
         }
 
-        gl_combo_util_set_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo),
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->page_size_combo),
                                        page_size_name);
 
         category_name = lgl_db_lookup_category_name_from_id (category_id);
@@ -633,7 +644,7 @@ gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select,
                 category_name = g_strdup (_("Any"));
         }
 
-        gl_combo_util_set_active_text (GTK_COMBO_BOX (media_select->priv->category_combo),
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->category_combo),
                                        category_name);
         g_free (page_size_name);
         g_free (category_name);
@@ -742,9 +753,10 @@ get_label_size_desc (const lglTemplate *template)
 /* PRIVATE.  Load list store from template name list.                       */
 /*--------------------------------------------------------------------------*/
 static void
-load_recent_list (GtkListStore           *store,
-                  GtkTreeSelection       *selection,
-                  GList                  *list)
+load_recent_list (glMediaSelect      *this,
+                  GtkListStore       *store,
+                  GtkTreeSelection   *selection,
+                  GList              *list)
 {
         GList       *p;
         GtkTreeIter  iter;
@@ -796,20 +808,25 @@ load_recent_list (GtkListStore           *store,
                 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
                 gtk_tree_selection_select_iter (selection, &iter);
 
+                if ( this->priv->recent_info_bar )
+                {
+                        gtk_container_remove (GTK_CONTAINER (this->priv->recent_info_vbox),
+                                              this->priv->recent_info_bar);
+                        this->priv->recent_info_bar = NULL;
+                }
         }
         else
         {
-                gchar *text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n%s",
-                                               _("No recent templates found."),
-                                               _("Try selecting a template from the \"Search all templates\" page."));
-                gtk_list_store_append (store, &iter);
-                gtk_list_store_set (store, &iter,
-                                    NAME_COLUMN, "empty",
-                                    PREVIEW_COLUMN_STOCK, GTK_STOCK_DIALOG_WARNING,
-                                    PREVIEW_COLUMN_STOCK_SIZE, GTK_ICON_SIZE_DIALOG,
-                                    DESCRIPTION_COLUMN, text,
-                                    -1);
-                g_free (text);
+                this->priv->recent_info_bar = gl_message_bar_new (GTK_MESSAGE_INFO,
+                                                                          GTK_BUTTONS_NONE,
+                                                                          "%s", _("No recent templates found."));
+                gl_message_bar_format_secondary_text (GL_MESSAGE_BAR (this->priv->recent_info_bar),
+                                                      "%s", _("Try selecting a template from the \"Search all templates\" page."));
+
+                gtk_box_pack_start (GTK_BOX (this->priv->recent_info_vbox),
+                                    this->priv->recent_info_bar,
+                                    FALSE, FALSE, 0);
+                gtk_widget_show_all (this->priv->recent_info_bar);
 
                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
 
@@ -823,9 +840,10 @@ load_recent_list (GtkListStore           *store,
 /* PRIVATE.  Load list store from template name list.                       */
 /*--------------------------------------------------------------------------*/
 static void
-load_search_all_list (GtkListStore           *store,
-                      GtkTreeSelection       *selection,
-                      GList                  *list)
+load_search_all_list (glMediaSelect      *this,
+                      GtkListStore       *store,
+                      GtkTreeSelection   *selection,
+                      GList              *list)
 {
         GList       *p;
         GtkTreeIter  iter;
@@ -877,20 +895,25 @@ load_search_all_list (GtkListStore           *store,
                 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
                 gtk_tree_selection_select_iter (selection, &iter);
 
+                if ( this->priv->search_all_info_bar )
+                {
+                        gtk_container_remove (GTK_CONTAINER (this->priv->search_all_info_vbox),
+                                              this->priv->search_all_info_bar);
+                        this->priv->search_all_info_bar = NULL;
+                }
         }
         else
         {
-                gchar *text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n%s",
-                                               _("No match."),
-                                               _("Try selecting a different brand, page size or category."));
-                gtk_list_store_append (store, &iter);
-                gtk_list_store_set (store, &iter,
-                                    NAME_COLUMN, "empty",
-                                    PREVIEW_COLUMN_STOCK, GTK_STOCK_DIALOG_WARNING,
-                                    PREVIEW_COLUMN_STOCK_SIZE, GTK_ICON_SIZE_DIALOG,
-                                    DESCRIPTION_COLUMN, text,
-                                    -1);
-                g_free (text);
+                this->priv->search_all_info_bar = gl_message_bar_new (GTK_MESSAGE_INFO,
+                                                                              GTK_BUTTONS_NONE,
+                                                                              "%s", _("No match."));
+                gl_message_bar_format_secondary_text (GL_MESSAGE_BAR (this->priv->search_all_info_bar),
+                                                      "%s", _("Try selecting a different brand, page size or category."));
+
+                gtk_box_pack_start (GTK_BOX (this->priv->search_all_info_vbox),
+                                    this->priv->search_all_info_bar,
+                                    FALSE, FALSE, 0);
+                gtk_widget_show_all (this->priv->search_all_info_bar);
 
                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
 
diff --git a/src/media-select.h b/src/media-select.h
new file mode 100644
index 0000000..6d086ea
--- /dev/null
+++ b/src/media-select.h
@@ -0,0 +1,87 @@
+/*
+ *  media-select.h
+ *  Copyright (C) 2001-2009  Jim Evins <evins snaught com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __MEDIA_SELECT_H__
+#define __MEDIA_SELECT_H__
+
+#include <gtk/gtk.h>
+
+
+G_BEGIN_DECLS
+
+#define GL_TYPE_MEDIA_SELECT (gl_media_select_get_type ())
+#define GL_MEDIA_SELECT(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_MEDIA_SELECT, glMediaSelect ))
+#define GL_MEDIA_SELECT_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_MEDIA_SELECT, glMediaSelectClass))
+#define GL_IS_MEDIA_SELECT(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_MEDIA_SELECT))
+#define GL_IS_MEDIA_SELECT_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_MEDIA_SELECT))
+
+typedef struct _glMediaSelect         glMediaSelect;
+typedef struct _glMediaSelectClass    glMediaSelectClass;
+
+typedef struct _glMediaSelectPrivate  glMediaSelectPrivate;
+
+struct _glMediaSelect {
+        GtkVBox                    parent_widget;
+
+        glMediaSelectPrivate  *priv;
+};
+
+struct _glMediaSelectClass {
+        GtkVBoxClass               parent_class;
+
+        void (*changed) (glMediaSelect * media_select, gpointer user_data);
+};
+
+
+GType      gl_media_select_get_type      (void) G_GNUC_CONST;
+
+GtkWidget *gl_media_select_new           (void);
+
+gchar     *gl_media_select_get_name      (glMediaSelect *this);
+
+void       gl_media_select_set_name      (glMediaSelect *this,
+                                          gchar         *name);
+
+void       gl_media_select_get_filter_parameters (glMediaSelect *this,
+                                                  gchar        **page_size_id,
+                                                  gchar        **category_id);
+
+void       gl_media_select_set_filter_parameters (glMediaSelect *this,
+                                                  const gchar   *page_size_id,
+                                                  const gchar   *category_id);
+
+G_END_DECLS
+
+#endif
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
diff --git a/src/message-bar.c b/src/message-bar.c
new file mode 100644
index 0000000..507afac
--- /dev/null
+++ b/src/message-bar.c
@@ -0,0 +1,248 @@
+/*
+ *  message-bar.c
+ *  Copyright (C) 2009  Jim Evins <evins snaught com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "message-bar.h"
+
+#include "debug.h"
+
+
+/*===========================================*/
+/* Private data types                        */
+/*===========================================*/
+
+struct _glMessageBarPrivate {
+
+        GtkWidget *icon;
+        GtkWidget *label;
+
+        gchar     *primary_text;
+        gchar     *secondary_text;
+};
+
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static void       gl_message_bar_finalize       (GObject               *object);
+
+static void       gl_message_bar_construct      (glMessageBar          *this,
+                                                 GtkMessageType         type,
+                                                 GtkButtonsType         buttons,
+                                                 const gchar           *message_format,
+                                                 va_list                args);
+
+
+/*****************************************************************************/
+/* Boilerplate object stuff.                                                 */
+/*****************************************************************************/
+G_DEFINE_TYPE (glMessageBar, gl_message_bar, GTK_TYPE_INFO_BAR);
+
+
+/*****************************************************************************/
+/* Class Init Function.                                                      */
+/*****************************************************************************/
+static void
+gl_message_bar_class_init (glMessageBarClass *class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  	gl_message_bar_parent_class = g_type_class_peek_parent (class);
+
+  	object_class->finalize = gl_message_bar_finalize;  	
+}
+
+
+/*****************************************************************************/
+/* Object Instance Init Function.                                            */
+/*****************************************************************************/
+static void
+gl_message_bar_init (glMessageBar *dialog)
+{
+	g_return_if_fail (GL_IS_MESSAGE_BAR (dialog));
+
+	dialog->priv = g_new0 (glMessageBarPrivate, 1);
+}
+
+
+/*****************************************************************************/
+/* Finalize Function.                                                        */
+/*****************************************************************************/
+static void 
+gl_message_bar_finalize (GObject *object)
+{
+	glMessageBar* dialog = GL_MESSAGE_BAR (object);;
+	
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (GL_IS_MESSAGE_BAR (dialog));
+	g_return_if_fail (dialog->priv != NULL);
+
+	g_free (dialog->priv->primary_text);
+	g_free (dialog->priv->secondary_text);
+	g_free (dialog->priv);
+
+	G_OBJECT_CLASS (gl_message_bar_parent_class)->finalize (object);
+}
+
+
+/*****************************************************************************/
+/* NEW message bar.                                                          */
+/*****************************************************************************/
+GtkWidget *
+gl_message_bar_new (GtkMessageType  type,
+                    GtkButtonsType  buttons,
+                    const gchar    *message_format,
+                    ...)
+{
+	GtkWidget *widget;
+        va_list    args;
+
+	widget = GTK_WIDGET (g_object_new (GL_TYPE_MESSAGE_BAR, NULL));
+        
+        va_start (args, message_format);
+        gl_message_bar_construct (GL_MESSAGE_BAR (widget), type, buttons, message_format, args);
+        va_end (args);
+
+	return widget;
+}
+
+
+/*****************************************************************************/
+/* Construct message bar.                                                    */
+/*****************************************************************************/
+static void
+gl_message_bar_construct (glMessageBar    *this,
+                          GtkMessageType   type,
+                          GtkButtonsType   buttons,
+                          const gchar     *message_format,
+                          va_list          args)
+{
+        GtkWidget *hbox;
+
+        gtk_info_bar_set_message_type (GTK_INFO_BAR (this), type);
+
+        this->priv->icon = gtk_image_new ();
+        switch (type)
+        {
+        case GTK_MESSAGE_INFO:
+                gtk_image_set_from_stock (GTK_IMAGE (this->priv->icon),
+                                          GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
+                break;
+        case GTK_MESSAGE_WARNING:
+                gtk_image_set_from_stock (GTK_IMAGE (this->priv->icon),
+                                          GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+                break;
+        case GTK_MESSAGE_QUESTION:
+                gtk_image_set_from_stock (GTK_IMAGE (this->priv->icon),
+                                          GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
+                break;
+        case GTK_MESSAGE_ERROR:
+                gtk_image_set_from_stock (GTK_IMAGE (this->priv->icon),
+                                          GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
+                break;
+        default:
+                break;
+        }
+
+        this->priv->primary_text = g_strdup_vprintf (message_format, args);
+        this->priv->label = gtk_label_new (this->priv->primary_text);
+
+        hbox = gtk_info_bar_get_content_area (GTK_INFO_BAR (this));
+        gtk_box_pack_start (GTK_BOX (hbox), this->priv->icon, FALSE, FALSE, 0);
+        gtk_box_pack_start (GTK_BOX (hbox), this->priv->label, FALSE, FALSE, 0);
+
+        switch (buttons)
+        {
+        case GTK_BUTTONS_OK:
+                gtk_info_bar_add_button (GTK_INFO_BAR (this),
+                                         GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
+                break;
+        case GTK_BUTTONS_CLOSE:
+                gtk_info_bar_add_button (GTK_INFO_BAR (this),
+                                         GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT);
+                break;
+        case GTK_BUTTONS_CANCEL:
+                gtk_info_bar_add_button (GTK_INFO_BAR (this),
+                                         GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+                break;
+        case GTK_BUTTONS_YES_NO:
+                gtk_info_bar_add_button (GTK_INFO_BAR (this),
+                                         GTK_STOCK_YES, GTK_RESPONSE_ACCEPT);
+                gtk_info_bar_add_button (GTK_INFO_BAR (this),
+                                         GTK_STOCK_NO, GTK_RESPONSE_REJECT);
+                break;
+        case GTK_BUTTONS_OK_CANCEL:
+                gtk_info_bar_add_button (GTK_INFO_BAR (this),
+                                         GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
+                gtk_info_bar_add_button (GTK_INFO_BAR (this),
+                                         GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+                break;
+        default:
+                break;
+        }
+}
+
+
+/*****************************************************************************/
+/* Set secondary text.                                                       */
+/*****************************************************************************/
+void
+gl_message_bar_format_secondary_text (glMessageBar   *this,
+                                      const gchar    *message_format,
+                                      ...)
+{
+        va_list    args;
+        gchar     *markup;
+
+        g_free (this->priv->secondary_text);
+
+        va_start (args, message_format);
+        this->priv->secondary_text = g_strdup_vprintf (message_format, args);
+        va_end (args);
+
+        markup = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n%s",
+                                  this->priv->primary_text,
+                                  this->priv->secondary_text);
+
+        gtk_label_set_markup (GTK_LABEL (this->priv->label), markup);
+
+        g_free (markup);
+}
+
+
+
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
diff --git a/src/message-bar.h b/src/message-bar.h
new file mode 100644
index 0000000..6bc5209
--- /dev/null
+++ b/src/message-bar.h
@@ -0,0 +1,87 @@
+/*
+ *  message-bar.h
+ *  Copyright (C) 2009  Jim Evins <evins snaught com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __MESSAGE_BAR_H__
+#define __MESSAGE_BAR_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GL_TYPE_MESSAGE_BAR            (gl_message_bar_get_type ())
+#define GL_MESSAGE_BAR(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_MESSAGE_BAR, glMessageBar))
+#define GL_MESSAGE_BAR_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_MESSAGE_BAR, glMessageBarClass))
+#define GL_IS_MESSAGE_BAR(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_MESSAGE_BAR))
+#define GL_IS_MESSAGE_BAR_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_MESSAGE_BAR))
+#define GL_MESSAGE_BAR_GET_CLASS(obj) \
+        (G_TYPE_INSTANCE_GET_CLASS ((obj), GL_TYPE_MESSAGE_BAR, glMessageBarClass))
+
+
+typedef struct _glMessageBar         glMessageBar;
+typedef struct _glMessageBarClass    glMessageBarClass;
+
+typedef struct _glMessageBarPrivate  glMessageBarPrivate;
+
+struct _glMessageBar
+{
+	GtkInfoBar           parent_instance;
+
+	glMessageBarPrivate *priv;
+
+};
+
+struct  _glMessageBarClass
+{
+	GtkInfoBarClass      parent_class;
+};
+
+
+GType      gl_message_bar_get_type                (void) G_GNUC_CONST;
+
+GtkWidget *gl_message_bar_new                     (GtkMessageType  type,
+                                                   GtkButtonsType  buttons,
+                                                   const gchar    *message_format,
+                                                   ...);
+
+void       gl_message_bar_format_secondary_text   (glMessageBar   *this,
+                                                   const gchar    *message_format,
+                                                   ...);
+
+
+
+
+G_END_DECLS
+
+#endif
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
diff --git a/src/new-label-dialog.c b/src/new-label-dialog.c
index c77e8cb..f01d0fb 100644
--- a/src/new-label-dialog.c
+++ b/src/new-label-dialog.c
@@ -26,7 +26,7 @@
 #include <gtk/gtk.h>
 
 #include "hig.h"
-#include "wdgt-media-select.h"
+#include "media-select.h"
 #include "rotate-label-button.h"
 
 #include "debug.h"
@@ -53,10 +53,10 @@ struct _glNewLabelDialogPrivate {
 /* Local function prototypes                 */
 /*===========================================*/
 
-static void       gl_new_label_dialog_finalize        (GObject               *object);
+static void       gl_new_label_dialog_finalize        (GObject           *object);
 
-static void       template_changed_cb                 (glWdgtMediaSelect     *select,
-						       gpointer               data);
+static void       template_changed_cb                 (glMediaSelect     *select,
+						       gpointer           data);
 
 
 /*****************************************************************************/
@@ -118,7 +118,7 @@ gl_new_label_dialog_init (glNewLabelDialog *dialog)
         gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
 	gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, GL_HIG_PAD1);
 
-	dialog->priv->media_select = gl_wdgt_media_select_new ();
+	dialog->priv->media_select = gl_media_select_new ();
         gtk_container_add (GTK_CONTAINER (frame), dialog->priv->media_select);
 
         label = gtk_label_new (_("<b>Label orientation</b>"));
@@ -132,7 +132,7 @@ gl_new_label_dialog_init (glNewLabelDialog *dialog)
         gtk_container_add (GTK_CONTAINER (frame), dialog->priv->rotate_label);
 
 	/* Sync template name from media select with rotate widget. */
-	name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select));
+	name = gl_media_select_get_name (GL_MEDIA_SELECT (dialog->priv->media_select));
 	gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label),
                                                   name);
 
@@ -188,15 +188,15 @@ gl_new_label_dialog_new (GtkWindow    *win)
 /* PRIVATE.  New template changed callback.                                  */
 /*---------------------------------------------------------------------------*/
 static void
-template_changed_cb (glWdgtMediaSelect *select,
-		     gpointer           data)
+template_changed_cb (glMediaSelect *select,
+		     gpointer       data)
 {
 	glNewLabelDialog  *dialog = GL_NEW_LABEL_DIALOG (data);
 	gchar             *name;
 
 	gl_debug (DEBUG_FILE, "START");
 
-	name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (select));
+	name = gl_media_select_get_name (GL_MEDIA_SELECT (select));
 
 	gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label),
                                                   name);
@@ -219,7 +219,7 @@ gl_new_label_dialog_get_template_name (glNewLabelDialog *dialog)
 {
 	gchar *name;
 
-	name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select));
+	name = gl_media_select_get_name (GL_MEDIA_SELECT (dialog->priv->media_select));
 
 	return name;
 }
@@ -232,7 +232,7 @@ void
 gl_new_label_dialog_set_template_name (glNewLabelDialog *dialog,
 				       gchar            *name)
 {
-	gl_wdgt_media_select_set_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select), name);
+	gl_media_select_set_name (GL_MEDIA_SELECT (dialog->priv->media_select), name);
 }
 
 
@@ -240,12 +240,12 @@ gl_new_label_dialog_set_template_name (glNewLabelDialog *dialog,
 /* Get current filter parameters.                                            */
 /*****************************************************************************/
 void
-gl_new_label_dialog_get_filter_parameters (glNewLabelDialog *dialog,
-					   gchar           **page_size_id,
-					   gchar           **category_id)
+gl_new_label_dialog_get_filter_parameters (glNewLabelDialog  *dialog,
+					   gchar            **page_size_id,
+					   gchar            **category_id)
 {
-	gl_wdgt_media_select_get_filter_parameters (
-		GL_WDGT_MEDIA_SELECT (dialog->priv->media_select),
+	gl_media_select_get_filter_parameters (
+		GL_MEDIA_SELECT (dialog->priv->media_select),
 		page_size_id, category_id);
 }
 
@@ -258,8 +258,8 @@ gl_new_label_dialog_set_filter_parameters (glNewLabelDialog *dialog,
 					   const gchar      *page_size_id,
 					   const gchar      *category_id)
 {
-	gl_wdgt_media_select_set_filter_parameters (
-		GL_WDGT_MEDIA_SELECT (dialog->priv->media_select),
+	gl_media_select_set_filter_parameters (
+		GL_MEDIA_SELECT (dialog->priv->media_select),
 		page_size_id, category_id);
 }
 



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