]> git.sur5r.net Git - glabels/blobdiff - src/new-label-dialog.c
Added translation context for "Select Product" (Bug #763003).
[glabels] / src / new-label-dialog.c
index fb9894c514b979945806c5f56d3f49fe39ded752..07807ae6a417a4f636c84cb316f57e7b89188c1a 100644 (file)
@@ -110,8 +110,6 @@ static gint       forward_page_function               (gint               curren
 static void       combo_changed_cb                    (glNewLabelDialog  *this);
 static void       rotate_toggled_cb                   (glNewLabelDialog  *this);
 
-static gchar     *get_default_name                    (void);
-
 static void       set_info                            (glNewLabelDialog  *this,
                                                        const gchar       *name);
 
@@ -119,7 +117,7 @@ static void       set_info                            (glNewLabelDialog  *this,
 /*****************************************************************************/
 /* Boilerplate object stuff.                                                 */
 /*****************************************************************************/
-G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_ASSISTANT);
+G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_ASSISTANT)
 
 
 /*****************************************************************************/
@@ -154,7 +152,9 @@ gl_new_label_dialog_class_init (glNewLabelDialogClass *class)
 static void
 gl_new_label_dialog_init (glNewLabelDialog *this)
 {
-        GtkWidget    *vbox;
+        GdkRGBA       banner_color = { 0, 0.5, 1.0, 1.0 };
+        GtkWidget    *page_1_banner_eventbox, *page_2_banner_eventbox, *page_3_banner_eventbox;
+        GtkWidget    *page_1_image, *page_2_image, *page_3_image;
         gchar        *logo_filename;
         GdkPixbuf    *logo;
         GtkBuilder   *builder;
@@ -164,7 +164,6 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
                                        "confirm_page_vbox",
                                        NULL };
         GError       *error = NULL;
-        GtkWidget    *new_label_dialog_hbox;
 
         gl_debug (DEBUG_FILE, "START");
 
@@ -173,7 +172,7 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
         this->priv = g_new0 (glNewLabelDialogPrivate, 1);
 
         builder = gtk_builder_new ();
-        builder_filename = g_build_filename (GLABELS_DATA_DIR, "builder", "new-label-dialog.builder", NULL);
+        builder_filename = g_build_filename (GLABELS_DATA_DIR, "ui", "new-label-dialog.ui", NULL);
         gtk_builder_add_objects_from_file (builder, builder_filename, object_ids, &error);
         g_free (builder_filename);
         if (error) {
@@ -183,6 +182,12 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
         }
 
         gl_builder_util_get_widgets (builder,
+                                     "page_1_banner_eventbox", &page_1_banner_eventbox,
+                                     "page_2_banner_eventbox", &page_2_banner_eventbox,
+                                     "page_3_banner_eventbox", &page_3_banner_eventbox,
+                                     "page_1_image",           &page_1_image,
+                                     "page_2_image",           &page_2_image,
+                                     "page_3_image",           &page_3_image,
                                      "template_page_vbox",     &this->priv->template_page_vbox,
                                      "combo_hbox",             &this->priv->combo_hbox,
                                      "rotate_page_vbox",       &this->priv->rotate_page_vbox,
@@ -204,11 +209,14 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
         this->priv->builder = builder;
 
         gtk_assistant_append_page (GTK_ASSISTANT (this), this->priv->template_page_vbox);
-        gtk_assistant_set_page_title (GTK_ASSISTANT (this), this->priv->template_page_vbox, _("Select Product"));
+        gtk_assistant_set_page_title (GTK_ASSISTANT (this), this->priv->template_page_vbox,
+                                      C_("Title of dialog page to select a stationary product",
+                                         "Select Product"));
         gtk_assistant_set_page_type (GTK_ASSISTANT (this), this->priv->template_page_vbox, GTK_ASSISTANT_PAGE_INTRO);
+        gtk_widget_override_background_color (page_1_banner_eventbox, GTK_STATE_NORMAL, &banner_color);
         logo_filename = g_build_filename (GLABELS_DATA_DIR, "pixmaps", "new-select.png", NULL);
         logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
-        gtk_assistant_set_page_header_image (GTK_ASSISTANT (this), this->priv->template_page_vbox, logo);
+        gtk_image_set_from_pixbuf (GTK_IMAGE (page_1_image), logo);
         g_free (logo_filename);
         g_object_unref (logo);
 
@@ -218,9 +226,10 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
         gtk_assistant_append_page (GTK_ASSISTANT (this), this->priv->rotate_page_vbox);
         gtk_assistant_set_page_title (GTK_ASSISTANT (this), this->priv->rotate_page_vbox, _("Choose Orientation"));
         gtk_assistant_set_page_complete (GTK_ASSISTANT (this), this->priv->rotate_page_vbox, TRUE);
+        gtk_widget_override_background_color (page_2_banner_eventbox, GTK_STATE_NORMAL, &banner_color);
         logo_filename = g_build_filename (GLABELS_DATA_DIR, "pixmaps", "new-rotate.png", NULL);
         logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
-        gtk_assistant_set_page_header_image (GTK_ASSISTANT (this), this->priv->rotate_page_vbox, logo);
+        gtk_image_set_from_pixbuf (GTK_IMAGE (page_2_image), logo);
         g_free (logo_filename);
         g_object_unref (logo);
 
@@ -233,9 +242,10 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
         gtk_assistant_set_page_title (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, _("Review"));
         gtk_assistant_set_page_type (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, GTK_ASSISTANT_PAGE_CONFIRM);
         gtk_assistant_set_page_complete (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, TRUE);
+        gtk_widget_override_background_color (page_3_banner_eventbox, GTK_STATE_NORMAL, &banner_color);
         logo_filename = g_build_filename (GLABELS_DATA_DIR, "pixmaps", "new-confirm.png", NULL);
         logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
-        gtk_assistant_set_page_header_image (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, logo);
+        gtk_image_set_from_pixbuf (GTK_IMAGE (page_3_image), logo);
         g_free (logo_filename);
         g_object_unref (logo);
 
@@ -464,6 +474,7 @@ set_info (glNewLabelDialog  *this,
                 escaped_url = g_markup_escape_text (vendor->url, -1);
                 markup = g_strdup_printf ("<a href='%s'>%s</a>", escaped_url, vendor->name);
                 gtk_label_set_markup (GTK_LABEL (this->priv->vendor_label), markup);
+                gtk_widget_set_tooltip_text (this->priv->vendor_label, escaped_url);
                 g_free (escaped_url);
                 g_free (markup);
         }
@@ -471,6 +482,7 @@ set_info (glNewLabelDialog  *this,
         {
                 /* FIXME: Using set_markup instead of set_text to clear out previous link. */
                 gtk_label_set_markup (GTK_LABEL (this->priv->vendor_label), template->brand);
+                gtk_widget_set_has_tooltip (this->priv->vendor_label, FALSE);
         }
 
         if ( template->product_url )
@@ -481,6 +493,7 @@ set_info (glNewLabelDialog  *this,
                 escaped_url = g_markup_escape_text (template->product_url, -1);
                 markup = g_strdup_printf ("<a href='%s'>%s</a>", escaped_url, template->part);
                 gtk_label_set_markup (GTK_LABEL (this->priv->part_label), markup);
+                gtk_widget_set_tooltip_text (this->priv->part_label, escaped_url);
                 g_free (escaped_url);
                 g_free (markup);
         }
@@ -488,6 +501,7 @@ set_info (glNewLabelDialog  *this,
         {
                 /* FIXME: Using set_markup instead of set_text to clear out previous link. */
                 gtk_label_set_markup (GTK_LABEL (this->priv->part_label), template->part);
+                gtk_widget_set_has_tooltip (this->priv->part_label, FALSE);
         }
 
         list = lgl_db_get_similar_template_name_list (name);