]> Pileus Git - ~andy/gtk/commitdiff
Custom tab label
authorMatthias Clasen <matthiasc@src.gnome.org>
Wed, 24 May 2006 16:15:15 +0000 (16:15 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 24 May 2006 16:15:15 +0000 (16:15 +0000)
ChangeLog
ChangeLog.pre-2-10
docs/reference/gtk/gtk-sections.txt
gtk/gtk.symbols
gtk/gtkprintoperation-private.h
gtk/gtkprintoperation-unix.c
gtk/gtkprintoperation.c
gtk/gtkprintoperation.h
tests/print-editor.c

index 37b29f6cb8a4b4ba1bc0f720d1ad78ea41d6bf74..21ecee29f3c5d05a386e10b363a0381092a24a73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-05-24  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkprintoperation.h: 
+       * gtk/gtkprintoperation-private.h: 
+       * gtk/gtk.symbols:
+       * gtk/gtkprintoperation.c: Add a custom-tab-label property.
+       
+       * gtk/gtkprintoperation-unix.c (get_print_dialog): Use it
+       here.  (#342752, Yevgen Muntyan)
+
 2006-05-24  Alexander Larsson  <alexl@redhat.com>
 
        * gtk/gtk.symbols:
index 37b29f6cb8a4b4ba1bc0f720d1ad78ea41d6bf74..21ecee29f3c5d05a386e10b363a0381092a24a73 100644 (file)
@@ -1,3 +1,13 @@
+2006-05-24  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkprintoperation.h: 
+       * gtk/gtkprintoperation-private.h: 
+       * gtk/gtk.symbols:
+       * gtk/gtkprintoperation.c: Add a custom-tab-label property.
+       
+       * gtk/gtkprintoperation-unix.c (get_print_dialog): Use it
+       here.  (#342752, Yevgen Muntyan)
+
 2006-05-24  Alexander Larsson  <alexl@redhat.com>
 
        * gtk/gtk.symbols:
index 4c39c82118ad18929dd608fdea2fc2b252468cb8..fc1a843a1079ac0b9962ab49c3cfe0c8103677cd 100644 (file)
@@ -6086,6 +6086,7 @@ gtk_print_operation_set_show_dialog
 gtk_print_operation_set_pdf_target 
 gtk_print_operation_set_show_progress
 gtk_print_operation_set_track_print_status
+gtk_print_operation_set_custom_tab_label
 gtk_print_operation_run_async
 gtk_print_operation_cancel
 gtk_print_operation_get_status
index d68fe751cbddc46147a82464a5c1cfa333f2bf5b..088069a8bf820b3e02f32cf880e455c052def2b7 100644 (file)
@@ -2697,6 +2697,7 @@ gtk_print_operation_set_show_dialog
 gtk_print_operation_set_pdf_target
 gtk_print_operation_set_track_print_status
 gtk_print_operation_set_show_progress
+gtk_print_operation_set_custom_tab_label
 gtk_print_operation_run
 gtk_print_operation_run_async
 gtk_print_operation_get_status
index 99237d5806cacf4fc61b18689b3759dc932c0027..55c7a93d0d8d41edeaa512e9c985c297ac0974f8 100644 (file)
@@ -60,6 +60,7 @@ struct _GtkPrintOperationPrivate
   double manual_scale;
   GtkPageSet manual_page_set;
   GtkWidget *custom_widget;
+  gchar *custom_tab_label;
   
   gpointer platform_data;
   GDestroyNotify free_platform_data;
index 77e98c4118bbf8054c4244bda7592cb434516719..33354df60dac43c525759f612ee02ad26f80e181 100644 (file)
@@ -179,7 +179,7 @@ get_print_dialog (GtkPrintOperation *op,
   GtkPrintOperationPrivate *priv = op->priv;
   GtkWidget *pd, *label;
   GtkPageSetup *page_setup;
-  const char *app_name;
+  const gchar *custom_tab_label;
 
   pd = gtk_print_unix_dialog_new (NULL, parent);
 
@@ -203,18 +203,24 @@ get_print_dialog (GtkPrintOperation *op,
   g_object_unref (page_setup);
 
   g_signal_emit_by_name (op, "create-custom-widget",
-                        &op->priv->custom_widget);
-
-  if (op->priv->custom_widget) {
-    app_name = g_get_application_name ();
-    if (app_name == NULL)
-      app_name = _("Application");
-    
-    label = gtk_label_new (app_name);
-    
-    gtk_print_unix_dialog_add_custom_tab (GTK_PRINT_UNIX_DIALOG (pd),
-                                         op->priv->custom_widget, label);
-  }
+                        &priv->custom_widget);
+
+  if (priv->custom_widget) 
+    {
+      custom_tab_label = priv->custom_tab_label;
+      
+      if (custom_tab_label == NULL)
+       {
+         custom_tab_label = g_get_application_name ();
+         if (custom_tab_label == NULL)
+           custom_tab_label = _("Application");
+       }
+
+      label = gtk_label_new (custom_tab_label);
+      
+      gtk_print_unix_dialog_add_custom_tab (GTK_PRINT_UNIX_DIALOG (pd),
+                                           op->priv->custom_widget, label);
+    }
   
   return pd;
 }
index 20c8962045c7f5b34d05a3e0ecf0d9d3b926aecf..e90b81ae09458b2a6196fdfffc6d69a7ecfa7aa7 100644 (file)
@@ -58,7 +58,8 @@ enum {
   PROP_SHOW_PROGRESS,
   PROP_PDF_TARGET,
   PROP_STATUS,
-  PROP_STATUS_STRING
+  PROP_STATUS_STRING,
+  PROP_CUSTOM_TAB_LABEL
 };
 
 static guint signals[LAST_SIGNAL] = { 0 };
@@ -105,6 +106,7 @@ gtk_print_operation_finalize (GObject *object)
   
   g_free (priv->pdf_target);
   g_free (priv->job_name);
+  g_free (priv->custom_tab_label);
 
   if (priv->print_pages_idle_id > 0)
     g_source_remove (priv->print_pages_idle_id);
@@ -184,6 +186,9 @@ gtk_print_operation_set_property (GObject      *object,
     case PROP_PDF_TARGET:
       gtk_print_operation_set_pdf_target (op, g_value_get_string (value));
       break;
+    case PROP_CUSTOM_TAB_LABEL:
+      gtk_print_operation_set_custom_tab_label (op, g_value_get_string (value));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -240,6 +245,9 @@ gtk_print_operation_get_property (GObject    *object,
     case PROP_STATUS_STRING:
       g_value_set_string (value, priv->status_string);
       break;
+    case PROP_CUSTOM_TAB_LABEL:
+      g_value_set_string (value, priv->custom_tab_label);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -743,6 +751,24 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
                                                        GTK_PARAM_READABLE));
   
 
+  /**
+   * GtkPrintOperation:custom-tab-label:
+   *
+   * Used as the label of the tab containing custom widgets.
+   * Note that this property may be ignored on some platforms.
+   * 
+   * If this is %NULL, GTK+ uses a default label.
+   *
+   * Since: 2.10
+   */
+  g_object_class_install_property (gobject_class,
+                                  PROP_CUSTOM_TAB_LABEL,
+                                  g_param_spec_string ("custom-tab-label",
+                                                       P_("Custom tab label"),
+                                                       P_("Label for the tab containing custom widgets."),
+                                                       NULL,
+                                                       GTK_PARAM_READWRITE));
+
 }
 
 /**
@@ -1262,6 +1288,32 @@ gtk_print_operation_set_show_progress (GtkPrintOperation  *op,
     }
 }
 
+/**
+ * gtk_print_operation_set_custom_tag_label:
+ * @op: a #GtkPrintOperation
+ * @label: the label to use, or %NULL to use the default label
+ *
+ * Sets the label for the tab holding custom widgets.
+ *
+ * Since: 2.10
+ */
+void
+gtk_print_operation_set_custom_tab_label (GtkPrintOperation  *op,
+                                         const gchar        *label)
+{
+  GtkPrintOperationPrivate *priv;
+
+  g_return_if_fail (GTK_IS_PRINT_OPERATION (op));
+
+  priv = op->priv;
+
+  g_free (priv->custom_tab_label);
+  priv->custom_tab_label = g_strdup (label);
+
+  g_object_notify (G_OBJECT (op), "custom-tab-label");
+}
+
+
 /**
  * gtk_print_operation_set_pdf_target:
  * @op: a #GtkPrintOperation
index f3003e4dc231c1e601789c002d6bada0c5bb3959..8f430850fafb95ff9b571fa77c8a513df7926321 100644 (file)
@@ -138,6 +138,8 @@ void                    gtk_print_operation_set_track_print_status (GtkPrintOper
                                                                    gboolean            track_status);
 void                    gtk_print_operation_set_show_progress      (GtkPrintOperation  *op,
                                                                    gboolean            show_progress);
+void                    gtk_print_operation_set_custom_tab_label   (GtkPrintOperation  *op,
+                                                                   const gchar        *label);
 GtkPrintOperationResult gtk_print_operation_run                    (GtkPrintOperation  *op,
                                                                    GtkWindow          *parent,
                                                                    GError            **error);
index 8775b1079b166afc93c3580bbfa51054bf2de455..eff83c583bffdd98b6ceb548dab354e5e7523cef 100644 (file)
@@ -399,6 +399,7 @@ create_custom_widget (GtkPrintOperation *operation,
 {
   GtkWidget *vbox, *hbox, *font, *label;
 
+  gtk_print_operation_set_custom_tab_label (operation, "Other");
   vbox = gtk_vbox_new (FALSE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);