[gimp] modules, plug-ins: use GimpColorProfileChooserDialog



commit 89b489b9bb01a53d0c167bb0e6e0b1099e40b303
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 14 23:01:19 2014 +0100

    modules, plug-ins: use GimpColorProfileChooserDialog
    
    instead of selfmade file choosers for picking color profiles from
    disk.

 modules/display-filter-proof.c |   50 +---------------------------------------
 plug-ins/common/lcms.c         |   50 +---------------------------------------
 2 files changed, 2 insertions(+), 98 deletions(-)
---
diff --git a/modules/display-filter-proof.c b/modules/display-filter-proof.c
index e4caca9..ceacc84 100644
--- a/modules/display-filter-proof.c
+++ b/modules/display-filter-proof.c
@@ -302,54 +302,6 @@ cdisplay_proof_file_chooser_dialog_response (GtkFileChooser           *dialog,
   gtk_widget_hide (GTK_WIDGET (dialog));
 }
 
-static GtkWidget *
-cdisplay_proof_file_chooser_dialog_new (void)
-{
-  GtkWidget     *dialog;
-  GtkFileFilter *filter;
-
-  dialog = gtk_file_chooser_dialog_new (_("Choose an ICC Color Profile"),
-                                        NULL,
-                                        GTK_FILE_CHOOSER_ACTION_OPEN,
-
-                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                        GTK_STOCK_OPEN,   GTK_RESPONSE_ACCEPT,
-
-                                        NULL);
-
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                           GTK_RESPONSE_ACCEPT,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-
-  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
-
-#ifndef G_OS_WIN32
-  {
-    const gchar folder[] = "/usr/share/color/icc";
-
-    if (g_file_test (folder, G_FILE_TEST_IS_DIR))
-      gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog),
-                                            folder, NULL);
-  }
-#endif
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("All files (*.*)"));
-  gtk_file_filter_add_pattern (filter, "*");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("ICC color profile (*.icc, *.icm)"));
-  gtk_file_filter_add_pattern (filter, "*.[Ii][Cc][Cc]");
-  gtk_file_filter_add_pattern (filter, "*.[Ii][Cc][Mm]");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  return dialog;
-}
-
 static void
 cdisplay_proof_profile_changed (GtkWidget     *combo,
                                 CdisplayProof *proof)
@@ -379,7 +331,7 @@ cdisplay_proof_configure (GimpColorDisplay *display)
   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
 
-  dialog = cdisplay_proof_file_chooser_dialog_new ();
+  dialog = gimp_color_profile_chooser_dialog_new (_("Choose an ICC Color Profile"));
 
   history = gimp_personal_rc_file ("profilerc");
   combo = gimp_color_profile_combo_box_new (dialog, history);
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index b23fca9..2d36e33 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -1361,54 +1361,6 @@ lcms_icc_file_chooser_dialog_response (GtkFileChooser           *dialog,
 }
 
 static GtkWidget *
-lcms_icc_file_chooser_dialog_new (void)
-{
-  GtkWidget     *dialog;
-  GtkFileFilter *filter;
-
-  dialog = gtk_file_chooser_dialog_new (_("Select destination profile"),
-                                        NULL,
-                                        GTK_FILE_CHOOSER_ACTION_OPEN,
-
-                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                        GTK_STOCK_OPEN,   GTK_RESPONSE_ACCEPT,
-
-                                        NULL);
-
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                           GTK_RESPONSE_ACCEPT,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-
-  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
-
-#ifndef G_OS_WIN32
-  {
-    const gchar folder[] = "/usr/share/color/icc";
-
-    if (g_file_test (folder, G_FILE_TEST_IS_DIR))
-      gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog),
-                                            folder, NULL);
-  }
-#endif
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("All files (*.*)"));
-  gtk_file_filter_add_pattern (filter, "*");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  filter = gtk_file_filter_new ();
-  gtk_file_filter_set_name (filter, _("ICC color profile (*.icc, *.icm)"));
-  gtk_file_filter_add_pattern (filter, "*.[Ii][Cc][Cc]");
-  gtk_file_filter_add_pattern (filter, "*.[Ii][Cc][Mm]");
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-  return dialog;
-}
-
-static GtkWidget *
 lcms_icc_combo_box_new (GimpColorConfig *config,
                         const gchar     *filename)
 {
@@ -1419,7 +1371,7 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
   gchar       *name;
   cmsHPROFILE  profile = NULL;
 
-  dialog = lcms_icc_file_chooser_dialog_new ();
+  dialog = gimp_color_profile_chooser_dialog_new (_("Select destination profile"));
   history = gimp_personal_rc_file ("profilerc");
 
   combo = gimp_color_profile_combo_box_new (dialog, history);


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