]> git.sur5r.net Git - glabels/blob - src/media-select.c
Updated Spanish translation
[glabels] / src / media-select.c
1 /*
2  *  media-select.c
3  *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
4  *
5  *  This file is part of gLabels.
6  *
7  *  gLabels is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  gLabels is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include <config.h>
22
23 #include "media-select.h"
24
25 #include <glib/gi18n.h>
26 #include <gtk/gtk.h>
27 #include <string.h>
28
29 #include <libglabels.h>
30 #include "mini-preview-pixbuf-cache.h"
31 #include "prefs.h"
32 #include "message-bar.h"
33 #include "template-history.h"
34 #include "template-designer.h"
35 #include "str-util.h"
36 #include "combo-util.h"
37 #include "builder-util.h"
38 #include "color.h"
39 #include "marshal.h"
40
41 #include "debug.h"
42
43
44 #define HISTORY_SIZE 5
45
46 /*===========================================*/
47 /* Private types                             */
48 /*===========================================*/
49
50 enum {
51         NAME_COLUMN,
52         PREVIEW_COLUMN,
53         PREVIEW_COLUMN_STOCK,
54         PREVIEW_COLUMN_STOCK_SIZE,
55         DESCRIPTION_COLUMN,
56         N_COLUMNS
57 };
58
59 struct _glMediaSelectPrivate {
60
61         gulong        db_notify_id;
62
63         GtkBuilder   *builder;
64
65         GtkWidget    *notebook;
66         guint         current_page_num;
67
68         gint          recent_page_num;
69         GtkWidget    *recent_tab_vbox;
70         GtkWidget    *recent_info_vbox;
71         GtkWidget    *recent_info_bar;
72         GtkWidget    *recent_treeview;
73         GtkListStore *recent_store;
74
75         gint          search_all_page_num;
76         GtkWidget    *search_all_tab_vbox;
77         GtkWidget    *search_all_info_vbox;
78         GtkWidget    *search_all_info_bar;
79         GtkWidget    *brand_combo_hbox;
80         GtkWidget    *brand_combo;
81         GtkWidget    *page_size_combo_hbox;
82         GtkWidget    *page_size_combo;
83         GtkWidget    *category_combo_hbox;
84         GtkWidget    *category_combo;
85         GtkWidget    *search_all_treeview;
86         GtkListStore *search_all_store;
87
88         gint          custom_page_num;
89         GtkWidget    *custom_tab_vbox;
90         GtkWidget    *custom_info_vbox;
91         GtkWidget    *custom_info_bar;
92         GtkWidget    *custom_treeview;
93         GtkListStore *custom_store;
94         GtkWidget    *custom_add_button;
95         GtkWidget    *custom_edit_button;
96         GtkWidget    *custom_delete_button;
97
98         /* Prevent recursion */
99         gboolean    stop_signals;
100 };
101
102 enum {
103         CHANGED,
104         LAST_SIGNAL
105 };
106
107
108 /*===========================================*/
109 /* Private globals                           */
110 /*===========================================*/
111
112 static gint signals[LAST_SIGNAL] = { 0 };
113
114
115 /*===========================================*/
116 /* Local function prototypes                 */
117 /*===========================================*/
118
119 static void   gl_media_select_finalize   (GObject                *object);
120
121 static void   gl_media_select_construct  (glMediaSelect          *this);
122
123 static void   filter_changed_cb          (glMediaSelect          *this);
124
125 static void   selection_changed_cb       (GtkTreeSelection       *selection,
126                                           gpointer                user_data);
127
128 static void   custom_add_clicked_cb      (GtkButton              *button,
129                                           gpointer                user_data);
130
131 static void   custom_edit_clicked_cb     (GtkButton              *button,
132                                           gpointer                user_data);
133
134 static void   custom_delete_clicked_cb   (GtkButton              *button,
135                                           gpointer                user_data);
136
137 static void   page_changed_cb            (GtkNotebook            *notebook,
138                                           GtkWidget              *page,
139                                           guint                   page_num,
140                                           gpointer                user_data);
141
142 static void   db_changed_cb              (glMediaSelect          *this);
143
144 static void   load_recent_list           (glMediaSelect          *this,
145                                           GtkListStore           *store,
146                                           GtkTreeSelection       *selection,
147                                           GList                  *list);
148
149 static void   load_custom_list          (glMediaSelect          *this,
150                                           GtkListStore           *store,
151                                           GtkTreeSelection       *selection,
152                                           GList                  *list);
153
154 static void   load_search_all_list       (glMediaSelect          *this,
155                                           GtkListStore           *store,
156                                           GtkTreeSelection       *selection,
157                                           GList                  *list);
158
159
160 /****************************************************************************/
161 /* Boilerplate Object stuff.                                                */
162 /****************************************************************************/
163 G_DEFINE_TYPE (glMediaSelect, gl_media_select, GTK_TYPE_VBOX)
164
165
166 static void
167 gl_media_select_class_init (glMediaSelectClass *class)
168 {
169         GObjectClass *object_class = G_OBJECT_CLASS (class);
170
171         gl_debug (DEBUG_MEDIA_SELECT, "START");
172
173         gl_media_select_parent_class = g_type_class_peek_parent (class);
174
175         object_class->finalize = gl_media_select_finalize;
176
177         signals[CHANGED] =
178             g_signal_new ("changed",
179                           G_OBJECT_CLASS_TYPE(object_class),
180                           G_SIGNAL_RUN_LAST,
181                           G_STRUCT_OFFSET (glMediaSelectClass, changed),
182                           NULL, NULL,
183                           gl_marshal_VOID__VOID,
184                           G_TYPE_NONE, 0);
185
186         gl_debug (DEBUG_MEDIA_SELECT, "END");
187 }
188
189
190 static void
191 gl_media_select_init (glMediaSelect *this)
192 {
193         gl_debug (DEBUG_MEDIA_SELECT, "START");
194
195         this->priv = g_new0 (glMediaSelectPrivate, 1);
196
197         gl_debug (DEBUG_MEDIA_SELECT, "END");
198 }
199
200
201 static void
202 gl_media_select_finalize (GObject *object)
203 {
204         glMediaSelect *this = GL_MEDIA_SELECT (object);
205
206         gl_debug (DEBUG_MEDIA_SELECT, "START");
207
208         g_return_if_fail (object != NULL);
209         g_return_if_fail (GL_IS_MEDIA_SELECT (object));
210
211         if (this->priv->db_notify_id)
212         {
213                 lgl_db_notify_remove (this->priv->db_notify_id);
214         }
215
216         if (this->priv->builder)
217         {
218                 g_object_unref (this->priv->builder);
219         }
220         g_object_unref (this->priv->recent_store);
221         g_object_unref (this->priv->search_all_store);
222         g_free (this->priv);
223
224         G_OBJECT_CLASS (gl_media_select_parent_class)->finalize (object);
225
226         gl_debug (DEBUG_MEDIA_SELECT, "END");
227 }
228
229
230 GtkWidget *
231 gl_media_select_new (void)
232 {
233         glMediaSelect *this;
234
235         gl_debug (DEBUG_MEDIA_SELECT, "START");
236
237         this = g_object_new (gl_media_select_get_type (), NULL);
238
239         gl_media_select_construct (this);
240
241         gl_debug (DEBUG_MEDIA_SELECT, "END");
242
243         return GTK_WIDGET (this);
244 }
245
246
247 /*--------------------------------------------------------------------------*/
248 /* PRIVATE.  Construct composite widget.                                    */
249 /*--------------------------------------------------------------------------*/
250 static void
251 gl_media_select_construct (glMediaSelect *this)
252 {
253         gchar             *builder_filename;
254         GtkBuilder        *builder;
255         static gchar      *object_ids[] = { "media_select_hbox",
256                                             "custom_buttons_sizegroup",
257                                             NULL };
258         GError            *error = NULL;
259         GtkWidget         *hbox;
260         GList             *recent_list = NULL;
261         GList             *brands = NULL;
262         GList             *page_sizes = NULL;
263         GList             *categories = NULL;
264         GList             *search_all_names = NULL;
265         const gchar       *page_size_id;
266         gchar             *page_size_name;
267         GList             *custom_list = NULL;
268         GtkCellRenderer   *renderer;
269         GtkTreeViewColumn *column;
270         GtkTreeSelection  *recent_selection;
271         GtkTreeSelection  *search_all_selection;
272         GtkTreeSelection  *custom_selection;
273
274         gl_debug (DEBUG_MEDIA_SELECT, "START");
275
276         g_return_if_fail (GL_IS_MEDIA_SELECT (this));
277         g_return_if_fail (this->priv != NULL);
278
279         builder = gtk_builder_new ();
280         builder_filename = g_build_filename (GLABELS_DATA_DIR, "ui", "media-select.ui", NULL);
281         gtk_builder_add_objects_from_file (builder, builder_filename, object_ids, &error);
282         g_free (builder_filename);
283         if (error) {
284                 g_critical ("%s\n\ngLabels may not be installed correctly!", error->message);
285                 g_error_free (error);
286                 return;
287         }
288
289         gl_builder_util_get_widgets (builder,
290                                      "media_select_hbox",      &hbox,
291                                      "notebook",               &this->priv->notebook,
292                                      "recent_tab_vbox",        &this->priv->recent_tab_vbox,
293                                      "recent_info_vbox",       &this->priv->recent_info_vbox,
294                                      "recent_treeview",        &this->priv->recent_treeview,
295                                      "search_all_tab_vbox",    &this->priv->search_all_tab_vbox,
296                                      "brand_combo_hbox",       &this->priv->brand_combo_hbox,
297                                      "page_size_combo_hbox",   &this->priv->page_size_combo_hbox,
298                                      "category_combo_hbox",    &this->priv->category_combo_hbox,
299                                      "search_all_info_vbox",   &this->priv->search_all_info_vbox,
300                                      "search_all_treeview",    &this->priv->search_all_treeview,
301                                      "custom_tab_vbox",        &this->priv->custom_tab_vbox,
302                                      "custom_info_vbox",       &this->priv->custom_info_vbox,
303                                      "custom_treeview",        &this->priv->custom_treeview,
304                                      "custom_add_button",      &this->priv->custom_add_button,
305                                      "custom_edit_button",     &this->priv->custom_edit_button,
306                                      "custom_delete_button",   &this->priv->custom_delete_button,
307                                      NULL);
308
309         gtk_container_add (GTK_CONTAINER (this), hbox);
310         this->priv->builder = builder;
311
312         this->priv->recent_page_num =
313                 gtk_notebook_page_num (GTK_NOTEBOOK (this->priv->notebook),
314                                        this->priv->recent_tab_vbox);
315         this->priv->search_all_page_num =
316                 gtk_notebook_page_num (GTK_NOTEBOOK (this->priv->notebook),
317                                        this->priv->search_all_tab_vbox);
318         this->priv->custom_page_num =
319                 gtk_notebook_page_num (GTK_NOTEBOOK (this->priv->notebook),
320                                        this->priv->custom_tab_vbox);
321
322         this->priv->brand_combo = gtk_combo_box_text_new ();
323         gtk_box_pack_start (GTK_BOX (this->priv->brand_combo_hbox), this->priv->brand_combo, FALSE, FALSE, 0);
324         this->priv->page_size_combo = gtk_combo_box_text_new ();
325         gtk_box_pack_start (GTK_BOX (this->priv->page_size_combo_hbox), this->priv->page_size_combo, FALSE, FALSE, 0);
326         this->priv->category_combo = gtk_combo_box_text_new ();
327         gtk_box_pack_start (GTK_BOX (this->priv->category_combo_hbox), this->priv->category_combo, FALSE, FALSE, 0);
328
329         gtk_widget_show_all (GTK_WIDGET (this));
330
331         /* Recent templates treeview */
332         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);
333         gtk_tree_view_set_model (GTK_TREE_VIEW (this->priv->recent_treeview),
334                                  GTK_TREE_MODEL (this->priv->recent_store));
335         renderer = gtk_cell_renderer_pixbuf_new ();
336         column = gtk_tree_view_column_new_with_attributes ("", renderer,
337                                                            "pixbuf", PREVIEW_COLUMN,
338                                                            "stock-id", PREVIEW_COLUMN_STOCK,
339                                                            "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
340                                                            NULL);
341         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
342         gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->recent_treeview), column);
343         renderer = gtk_cell_renderer_text_new ();
344         column = gtk_tree_view_column_new_with_attributes ("", renderer,
345                                                            "markup", DESCRIPTION_COLUMN,
346                                                            NULL);
347         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
348         gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->recent_treeview), column);
349         recent_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->recent_treeview));
350         recent_list = gl_template_history_model_get_name_list (gl_template_history);
351         load_recent_list (this, this->priv->recent_store, recent_selection, recent_list);
352
353         page_size_id = gl_prefs_model_get_default_page_size (gl_prefs);
354         page_size_name = lgl_db_lookup_paper_name_from_id (page_size_id);
355
356         /* Brand selection control */
357         brands = lgl_db_get_brand_list (NULL, NULL);
358         brands = g_list_prepend (brands, g_strdup (C_("Brand", "Any")));
359         gl_combo_util_set_strings (GTK_COMBO_BOX_TEXT (this->priv->brand_combo), brands);
360         lgl_db_free_brand_list (brands);
361         gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->brand_combo), C_("Brand", "Any"));
362
363         /* Page size selection control */
364         page_sizes = lgl_db_get_paper_name_list ();
365         page_sizes = g_list_prepend (page_sizes, g_strdup (C_("Page size", "Any")));
366         gl_combo_util_set_strings (GTK_COMBO_BOX_TEXT (this->priv->page_size_combo), page_sizes);
367         lgl_db_free_paper_name_list (page_sizes);
368         gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->page_size_combo), page_size_name);
369
370         /* Category selection control */
371         categories = lgl_db_get_category_name_list ();
372         categories = g_list_prepend (categories, g_strdup (C_("Category", "Any")));
373         gl_combo_util_set_strings (GTK_COMBO_BOX_TEXT (this->priv->category_combo), categories);
374         lgl_db_free_category_name_list (categories);
375         gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->category_combo), C_("Category", "Any"));
376
377         /* Search all treeview */
378         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);
379         gtk_tree_view_set_model (GTK_TREE_VIEW (this->priv->search_all_treeview),
380                                  GTK_TREE_MODEL (this->priv->search_all_store));
381         renderer = gtk_cell_renderer_pixbuf_new ();
382         column = gtk_tree_view_column_new_with_attributes ("", renderer,
383                                                            "pixbuf", PREVIEW_COLUMN,
384                                                            "stock-id", PREVIEW_COLUMN_STOCK,
385                                                            "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
386                                                            NULL);
387         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
388         gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->search_all_treeview), column);
389         renderer = gtk_cell_renderer_text_new ();
390         column = gtk_tree_view_column_new_with_attributes ("", renderer,
391                                                            "markup", DESCRIPTION_COLUMN,
392                                                            NULL);
393         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
394         gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->search_all_treeview), column);
395         search_all_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
396         search_all_names = lgl_db_get_template_name_list_all (NULL, page_size_id, NULL);
397         load_search_all_list (this, this->priv->search_all_store, search_all_selection, search_all_names);
398         lgl_db_free_template_name_list (search_all_names);
399
400         /* Custom templates treeview */
401         this->priv->custom_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
402         gtk_tree_view_set_model (GTK_TREE_VIEW (this->priv->custom_treeview),
403                                  GTK_TREE_MODEL (this->priv->custom_store));
404         renderer = gtk_cell_renderer_pixbuf_new ();
405         column = gtk_tree_view_column_new_with_attributes ("", renderer,
406                                                            "pixbuf", PREVIEW_COLUMN,
407                                                            "stock-id", PREVIEW_COLUMN_STOCK,
408                                                            "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
409                                                            NULL);
410         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
411         gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->custom_treeview), column);
412         renderer = gtk_cell_renderer_text_new ();
413         column = gtk_tree_view_column_new_with_attributes ("", renderer,
414                                                            "markup", DESCRIPTION_COLUMN,
415                                                            NULL);
416         gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
417         gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->custom_treeview), column);
418         custom_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->custom_treeview));
419         custom_list = lgl_db_get_template_name_list_all (NULL, NULL, "user-defined");
420         load_custom_list (this, this->priv->custom_store, custom_selection, custom_list);
421         lgl_db_free_template_name_list (custom_list);
422
423         page_size_id = gl_prefs_model_get_default_page_size (gl_prefs);
424         page_size_name = lgl_db_lookup_paper_name_from_id (page_size_id);
425
426         /* Connect signals to controls */
427         g_signal_connect_swapped (G_OBJECT (this->priv->brand_combo), "changed",
428                                   G_CALLBACK (filter_changed_cb),
429                                   this);
430         g_signal_connect_swapped (G_OBJECT (this->priv->page_size_combo), "changed",
431                                   G_CALLBACK (filter_changed_cb),
432                                   this);
433         g_signal_connect_swapped (G_OBJECT (this->priv->category_combo), "changed",
434                                   G_CALLBACK (filter_changed_cb),
435                                   this);
436         g_signal_connect (G_OBJECT (recent_selection), "changed",
437                           G_CALLBACK (selection_changed_cb),
438                           this);
439         g_signal_connect (G_OBJECT (search_all_selection), "changed",
440                           G_CALLBACK (selection_changed_cb),
441                           this);
442         g_signal_connect (G_OBJECT (custom_selection), "changed",
443                           G_CALLBACK (selection_changed_cb),
444                           this);
445         g_signal_connect (G_OBJECT (this->priv->custom_add_button), "clicked",
446                           G_CALLBACK (custom_add_clicked_cb),
447                           this);
448         g_signal_connect (G_OBJECT (this->priv->custom_edit_button), "clicked",
449                           G_CALLBACK (custom_edit_clicked_cb),
450                           this);
451         g_signal_connect (G_OBJECT (this->priv->custom_delete_button), "clicked",
452                           G_CALLBACK (custom_delete_clicked_cb),
453                           this);
454         g_signal_connect (G_OBJECT (this->priv->notebook), "switch-page",
455                           G_CALLBACK (page_changed_cb),
456                           this);
457
458         g_free (page_size_name);
459
460         if ( recent_list )
461         {
462                 gtk_notebook_set_current_page (GTK_NOTEBOOK (this->priv->notebook),
463                                                this->priv->recent_page_num);
464         }
465         else
466         {
467                 gtk_notebook_set_current_page (GTK_NOTEBOOK (this->priv->notebook),
468                                                this->priv->search_all_page_num);
469         }
470         gl_template_history_model_free_name_list (recent_list);
471
472         this->priv->db_notify_id = lgl_db_notify_add ((lglDbNotifyFunc)db_changed_cb, this);
473
474         gl_debug (DEBUG_MEDIA_SELECT, "END");
475 }
476
477
478 /*--------------------------------------------------------------------------*/
479 /* PRIVATE.  modify widget due to change in selection                       */
480 /*--------------------------------------------------------------------------*/
481 static void
482 filter_changed_cb (glMediaSelect *this)
483 {
484         gchar             *brand;
485         gchar             *page_size_name, *page_size_id;
486         gchar             *category_name, *category_id;
487         GList             *search_all_names;
488         GtkTreeSelection  *selection;
489
490         gl_debug (DEBUG_MEDIA_SELECT, "START");
491
492
493         this->priv->stop_signals = TRUE;
494
495         /* Update template selections for new filter settings */
496         brand = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->brand_combo));
497         page_size_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->page_size_combo));
498         category_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->category_combo));
499         if ( brand && strlen(brand) &&
500              page_size_name && strlen(page_size_name) &&
501              category_name && strlen(category_name) )
502         {
503                 gl_debug (DEBUG_MEDIA_SELECT, "brand = \"%s\"", brand);
504                 gl_debug (DEBUG_MEDIA_SELECT, "page_size_name = \"%s\"", page_size_name);
505                 gl_debug (DEBUG_MEDIA_SELECT, "category_name = \"%s\"", category_name);
506                 if (!g_utf8_collate (brand, C_("Brand", "Any")))
507                 {
508                         g_free (brand);
509                         brand = NULL;
510                 }
511                 page_size_id = lgl_db_lookup_paper_id_from_name (page_size_name);
512                 category_id = lgl_db_lookup_category_id_from_name (category_name);
513                 gl_debug (DEBUG_MEDIA_SELECT, "page_size_id = \"%s\"", page_size_id);
514                 gl_debug (DEBUG_MEDIA_SELECT, "category_id = \"%s\"", category_id);
515                 search_all_names = lgl_db_get_template_name_list_all (brand, page_size_id, category_id);
516                 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
517                 load_search_all_list (this, this->priv->search_all_store, selection, search_all_names);
518                 lgl_db_free_template_name_list (search_all_names);
519                 g_free (page_size_id);
520                 g_free (category_id);
521
522                 /* Emit our "changed" signal */
523                 g_signal_emit (G_OBJECT (this), signals[CHANGED], 0);
524         }
525         g_free (brand);
526         g_free (page_size_name);
527         g_free (category_name);
528
529
530         this->priv->stop_signals = FALSE;
531
532         gl_debug (DEBUG_MEDIA_SELECT, "END");
533 }
534
535
536 /*--------------------------------------------------------------------------*/
537 /* PRIVATE.  modify widget due to change in selection                       */
538 /*--------------------------------------------------------------------------*/
539 static void
540 selection_changed_cb (GtkTreeSelection       *selection,
541                       gpointer                user_data)
542 {
543         glMediaSelect     *this = GL_MEDIA_SELECT (user_data);
544         GtkTreeSelection  *custom_selection;
545
546         if (this->priv->stop_signals) return;
547
548         gl_debug (DEBUG_MEDIA_SELECT, "START");
549
550         custom_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->custom_treeview));
551         gtk_widget_set_sensitive (GTK_WIDGET (this->priv->custom_edit_button),
552                                   gtk_tree_selection_get_mode (custom_selection) != GTK_SELECTION_NONE );
553         gtk_widget_set_sensitive (GTK_WIDGET (this->priv->custom_delete_button),
554                                   gtk_tree_selection_get_mode (custom_selection) != GTK_SELECTION_NONE );
555
556         /* Emit our "changed" signal */
557         g_signal_emit (G_OBJECT (user_data), signals[CHANGED], 0);
558
559         gl_debug (DEBUG_MEDIA_SELECT, "END");
560 }
561
562
563 /*--------------------------------------------------------------------------*/
564 /* PRIVATE.  Custom add button clicked callback.                            */
565 /*--------------------------------------------------------------------------*/
566 static void
567 custom_add_clicked_cb (GtkButton  *button,
568                        gpointer    user_data)
569 {
570         glMediaSelect *this = GL_MEDIA_SELECT (user_data);
571         GtkWidget     *window;
572         GtkWidget     *dialog;
573
574         window = gtk_widget_get_toplevel (GTK_WIDGET (this));
575         
576         dialog = gl_template_designer_new (GTK_WINDOW (window));
577
578         gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
579         gtk_widget_show (dialog);
580 }
581
582
583 /*--------------------------------------------------------------------------*/
584 /* PRIVATE.  Custom edit button clicked callback.                           */
585 /*--------------------------------------------------------------------------*/
586 static void
587 custom_edit_clicked_cb (GtkButton  *button,
588                         gpointer    user_data)
589 {
590         glMediaSelect     *this = GL_MEDIA_SELECT (user_data);
591         GtkTreeSelection  *selection;
592         GtkTreeIter        iter;
593         GtkTreeModel      *model;
594         gchar             *name;
595         GtkWidget         *window;
596         GtkWidget         *dialog;
597
598         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->custom_treeview));
599
600         if (!gtk_tree_selection_get_mode (selection) == GTK_SELECTION_NONE)
601         {
602                 gtk_tree_selection_get_selected (selection, &model, &iter);
603                 gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
604
605                 window = gtk_widget_get_toplevel (GTK_WIDGET (this));
606
607                 dialog = gl_template_designer_new (GTK_WINDOW (window));
608                 gl_template_designer_set_from_name (GL_TEMPLATE_DESIGNER (dialog), name);
609
610                 gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
611                 gtk_widget_show (dialog);
612
613                 g_free (name);
614         }
615 }
616
617
618 /*--------------------------------------------------------------------------*/
619 /* PRIVATE.  Custom delete button clicked callback.                         */
620 /*--------------------------------------------------------------------------*/
621 static void
622 custom_delete_clicked_cb (GtkButton  *button,
623                           gpointer    user_data)
624 {
625         glMediaSelect     *this = GL_MEDIA_SELECT (user_data);
626         GtkTreeSelection  *selection;
627         GtkTreeIter        iter;
628         GtkTreeModel      *model;        
629         gchar             *name;
630         GtkWidget         *window;
631         GtkWidget         *dialog;
632         gint               ret;
633
634         this->priv->stop_signals = TRUE;
635
636         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->custom_treeview));
637
638         if (!gtk_tree_selection_get_mode (selection) == GTK_SELECTION_NONE)
639         {
640                 gtk_tree_selection_get_selected (selection, &model, &iter);
641                 gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
642
643                 window = gtk_widget_get_toplevel (GTK_WIDGET (this));
644                 dialog = gtk_message_dialog_new (GTK_WINDOW (window),
645                                                  GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
646                                                  GTK_MESSAGE_QUESTION,
647                                                  GTK_BUTTONS_YES_NO,
648                                                  _("Delete template \"%s\"?"), name);
649                 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
650                                                           _("This action will permanently delete this template."));
651
652                 ret = gtk_dialog_run (GTK_DIALOG (dialog));
653                 gtk_widget_destroy (dialog);
654                 
655                 if ( ret == GTK_RESPONSE_YES )
656                 {
657                         lgl_db_delete_template_by_name (name);
658                         gl_mini_preview_pixbuf_cache_delete_by_name (name);
659                 }
660
661                 g_free (name);
662         }
663
664         this->priv->stop_signals = FALSE;
665 }
666
667
668 /*--------------------------------------------------------------------------*/
669 /* PRIVATE.  modify widget due to change in selection                       */
670 /*--------------------------------------------------------------------------*/
671 static void
672 page_changed_cb (GtkNotebook            *notebook,
673                  GtkWidget              *page,
674                  guint                   page_num,
675                  gpointer                user_data)
676 {
677         glMediaSelect *this = GL_MEDIA_SELECT (user_data);
678
679         if (this->priv->stop_signals) return;
680
681         gl_debug (DEBUG_MEDIA_SELECT, "START");
682
683         /*
684          * Store new current page, because this signal is emitted before the actual page change.
685          */
686         this->priv->current_page_num = page_num;
687
688         /* Emit our "changed" signal */
689         g_signal_emit (G_OBJECT (user_data), signals[CHANGED], 0);
690
691         gl_debug (DEBUG_MEDIA_SELECT, "END");
692 }
693
694
695 /*--------------------------------------------------------------------------*/
696 /* PRIVATE.  DB changed notification callback.                              */
697 /*--------------------------------------------------------------------------*/
698 static void
699 db_changed_cb (glMediaSelect *this)
700 {
701         gchar             *brand;
702         gchar             *page_size_name, *page_size_id;
703         gchar             *category_name, *category_id;
704         GtkTreeSelection  *selection;
705         GList             *list;
706
707         this->priv->stop_signals = TRUE;
708
709         /* Update recent page. */
710         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->recent_treeview));
711         list = gl_template_history_model_get_name_list (gl_template_history);
712         load_recent_list (this, this->priv->recent_store, selection, list);
713         lgl_db_free_template_name_list (list);
714
715         /* Update search all page. */
716         brand = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->brand_combo));
717         page_size_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->page_size_combo));
718         category_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->category_combo));
719         if ( brand && strlen(brand) &&
720              page_size_name && strlen(page_size_name) &&
721              category_name && strlen(category_name) )
722         {
723                 if (!g_utf8_collate (brand, C_("Brand", "Any")))
724                 {
725                         g_free (brand);
726                         brand = NULL;
727                 }
728                 page_size_id = lgl_db_lookup_paper_id_from_name (page_size_name);
729                 category_id = lgl_db_lookup_category_id_from_name (category_name);
730                 list = lgl_db_get_template_name_list_all (brand, page_size_id, category_id);
731                 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
732                 load_search_all_list (this, this->priv->search_all_store, selection, list);
733                 lgl_db_free_template_name_list (list);
734                 g_free (page_size_id);
735                 g_free (category_id);
736         }
737         g_free (brand);
738         g_free (page_size_name);
739         g_free (category_name);
740
741         /* Update custom page. */
742         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->custom_treeview));
743         list = lgl_db_get_template_name_list_all (NULL, NULL, "user-defined");
744         load_custom_list (this, this->priv->custom_store, selection, list);
745         lgl_db_free_template_name_list (list);
746
747         this->priv->stop_signals = FALSE;
748
749         /* Emit our "changed" signal */
750         g_signal_emit (G_OBJECT (this), signals[CHANGED], 0);
751
752         filter_changed_cb (this);
753 }
754
755
756 /****************************************************************************/
757 /* query selected label template name.                                      */
758 /****************************************************************************/
759 gchar *
760 gl_media_select_get_name (glMediaSelect *this)
761 {
762         gint               page_num;
763         GtkTreeSelection  *selection;
764         GtkTreeIter        iter;
765         GtkTreeModel      *model;        
766         gchar             *name;
767
768         gl_debug (DEBUG_MEDIA_SELECT, "START");
769
770         page_num = this->priv->current_page_num;
771         if (page_num == this->priv->recent_page_num)
772         {
773                 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->recent_treeview));
774         }
775         else if (page_num == this->priv->search_all_page_num)
776         {
777                 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
778         }
779         else if (page_num == this->priv->custom_page_num)
780         {
781                 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->custom_treeview));
782         }
783         else
784         {
785                 g_print ("notebook page = %d\n", page_num);
786                 g_assert_not_reached ();
787         }
788
789         if (gtk_tree_selection_get_mode (selection) == GTK_SELECTION_NONE)
790         {
791                 name = NULL;
792         }
793         else
794         {
795                 gtk_tree_selection_get_selected (selection, &model, &iter);
796                 gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
797         }
798
799         gl_debug (DEBUG_MEDIA_SELECT, "END");
800         return name;
801 }
802
803
804 /****************************************************************************/
805 /* set selected label template name.                                        */
806 /****************************************************************************/
807 void
808 gl_media_select_set_name (glMediaSelect *this,
809                           gchar         *name)
810 {
811         GtkTreeSelection  *selection;
812         GtkTreeModel      *model;
813         GtkTreeIter        iter;
814         GtkTreePath       *path;
815         gchar             *name_i;
816         gboolean           flag;
817
818         gl_debug (DEBUG_MEDIA_SELECT, "START");
819
820         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
821         g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
822
823         model = GTK_TREE_MODEL (this->priv->search_all_store);
824
825         for ( flag = gtk_tree_model_get_iter_first (model, &iter);
826               flag;
827               flag = gtk_tree_model_iter_next(model, &iter) )
828         {
829                 gtk_tree_model_get (model, &iter, NAME_COLUMN, &name_i, -1); 
830                 if (lgl_str_utf8_casecmp(name, name_i) == 0)
831                 {
832                         gtk_tree_selection_select_iter (selection, &iter);
833                         path = gtk_tree_model_get_path (model, &iter);
834                         gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (this->priv->search_all_treeview),
835                                                       path,
836                                                       NULL,
837                                                       TRUE, 0.5, 0.0);
838                         gtk_tree_path_free (path);
839                         break;
840                 }
841         }
842
843         gl_debug (DEBUG_MEDIA_SELECT, "END");
844 }
845
846
847 /****************************************************************************/
848 /* query current filter parameters.                                         */
849 /****************************************************************************/
850 void
851 gl_media_select_get_filter_parameters (glMediaSelect  *this,
852                                        gchar         **page_size_id,
853                                        gchar         **category_id)
854 {
855         gchar *page_size_name, *category_name;
856
857         gl_debug (DEBUG_MEDIA_SELECT, "");
858
859         g_free (*page_size_id);
860         g_free (*category_id);
861
862         page_size_name =
863                 gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->page_size_combo));
864
865         *page_size_id = lgl_db_lookup_paper_id_from_name (page_size_name);
866
867         category_name =
868                 gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (this->priv->category_combo));
869
870         *category_id = lgl_db_lookup_category_id_from_name (category_name);
871
872         g_free (page_size_name);
873         g_free (category_name);
874 }
875
876
877 /****************************************************************************/
878 /* set filter parameters.                                                   */
879 /****************************************************************************/
880 void
881 gl_media_select_set_filter_parameters (glMediaSelect  *this,
882                                        const gchar    *page_size_id,
883                                        const gchar    *category_id)
884 {
885         gchar *page_size_name;
886         gchar *category_name;
887
888         gl_debug (DEBUG_MEDIA_SELECT, "START");
889
890         page_size_name = lgl_db_lookup_paper_name_from_id (page_size_id);
891         if (page_size_name == NULL)
892         {
893                 page_size_name = g_strdup (C_("Page size", "Any"));
894         }
895
896         gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->page_size_combo),
897                                        page_size_name);
898
899         category_name = lgl_db_lookup_category_name_from_id (category_id);
900         if (category_name == NULL)
901         {
902                 category_name = g_strdup (C_("Category", "Any"));
903         }
904
905         gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->category_combo),
906                                        category_name);
907         g_free (page_size_name);
908         g_free (category_name);
909
910         gl_debug (DEBUG_MEDIA_SELECT, "END");
911 }
912
913
914 /*--------------------------------------------------------------------------*/
915 /* PRIVATE.  Load list store from template name list.                       */
916 /*--------------------------------------------------------------------------*/
917 static void
918 load_recent_list (glMediaSelect      *this,
919                   GtkListStore       *store,
920                   GtkTreeSelection   *selection,
921                   GList              *list)
922 {
923         GList            *p;
924         GtkTreeIter       iter;
925         lglUnits          units;
926         lglTemplate      *template;
927         lglTemplateFrame *frame;
928         GdkPixbuf        *pixbuf;
929         gchar            *size;
930         gchar            *layout;
931         gchar            *description;
932
933         gl_debug (DEBUG_MEDIA_SELECT, "START");
934
935         gtk_list_store_clear (store);
936
937
938         if ( this->priv->recent_info_bar )
939         {
940                 gtk_container_remove (GTK_CONTAINER (this->priv->recent_info_vbox),
941                                       this->priv->recent_info_bar);
942                 this->priv->recent_info_bar = NULL;
943         }
944
945         if (list)
946         {
947
948                 units = gl_prefs_model_get_units (gl_prefs);
949
950                 for ( p=list; p!=NULL; p=p->next )
951                 {
952
953                         gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data);
954
955                         template = lgl_db_lookup_template_from_name (p->data);
956                         frame    = (lglTemplateFrame *)template->frames->data;
957                         pixbuf   = gl_mini_preview_pixbuf_cache_get_pixbuf (p->data);
958
959                         size     = lgl_template_frame_get_size_description (frame, units);
960                         layout   = lgl_template_frame_get_layout_description (frame);
961                         description = g_strdup_printf ("<b>%s: %s</b>\n%s\n%s",
962                                                        (gchar *)p->data,
963                                                        template->description,
964                                                        size,
965                                                        layout);
966                         g_free (size);
967                         g_free (layout);
968
969                         lgl_template_free (template);
970
971                         gtk_list_store_append (store, &iter);
972                         gtk_list_store_set (store, &iter,
973                                             NAME_COLUMN, p->data,
974                                             PREVIEW_COLUMN, pixbuf,
975                                             DESCRIPTION_COLUMN, description,
976                                             -1);
977
978                         g_object_unref (G_OBJECT (pixbuf));
979                         g_free (description);
980                 }
981
982                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
983                 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
984                 gtk_tree_selection_select_iter (selection, &iter);
985
986         }
987         else
988         {
989                 this->priv->recent_info_bar = gl_message_bar_new (GTK_MESSAGE_INFO, GTK_BUTTONS_NONE,
990                                                                   "%s", _("No recent templates found."));
991                 gl_message_bar_format_secondary_text (GL_MESSAGE_BAR (this->priv->recent_info_bar),
992                                                       "%s", _("Try selecting a template in the \"Search all\" tab."));
993
994                 gtk_box_pack_start (GTK_BOX (this->priv->recent_info_vbox),
995                                     this->priv->recent_info_bar,
996                                     FALSE, FALSE, 0);
997                 gtk_widget_show_all (this->priv->recent_info_bar);
998
999                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
1000
1001         }
1002
1003         gl_debug (DEBUG_MEDIA_SELECT, "END");
1004 }
1005
1006
1007 /*--------------------------------------------------------------------------*/
1008 /* PRIVATE.  Load list store from template name list.                       */
1009 /*--------------------------------------------------------------------------*/
1010 static void
1011 load_search_all_list (glMediaSelect      *this,
1012                       GtkListStore       *store,
1013                       GtkTreeSelection   *selection,
1014                       GList              *list)
1015 {
1016         GList            *p;
1017         GtkTreeIter       iter;
1018         lglUnits          units;
1019         lglTemplate      *template;
1020         lglTemplateFrame *frame;
1021         GdkPixbuf        *pixbuf;
1022         gchar            *size;
1023         gchar            *layout;
1024         gchar            *description;
1025
1026         gl_debug (DEBUG_MEDIA_SELECT, "START");
1027
1028         gtk_list_store_clear (store);
1029
1030         if ( this->priv->search_all_info_bar )
1031         {
1032                 gtk_container_remove (GTK_CONTAINER (this->priv->search_all_info_vbox),
1033                                       this->priv->search_all_info_bar);
1034                 this->priv->search_all_info_bar = NULL;
1035         }
1036
1037         if (list)
1038         {
1039
1040                 units = gl_prefs_model_get_units (gl_prefs);
1041
1042                 for ( p=list; p!=NULL; p=p->next )
1043                 {
1044
1045                         gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data);
1046
1047                         template = lgl_db_lookup_template_from_name (p->data);
1048                         frame    = (lglTemplateFrame *)template->frames->data;
1049                         pixbuf   = gl_mini_preview_pixbuf_cache_get_pixbuf (p->data);
1050
1051                         size     = lgl_template_frame_get_size_description (frame, units);
1052                         layout   = lgl_template_frame_get_layout_description (frame);
1053                         description = g_strdup_printf ("<b>%s: %s</b>\n%s\n%s",
1054                                                        (gchar *)p->data,
1055                                                        template->description,
1056                                                        size,
1057                                                        layout);
1058                         g_free (size);
1059                         g_free (layout);
1060
1061                         lgl_template_free (template);
1062
1063                         gtk_list_store_append (store, &iter);
1064                         gtk_list_store_set (store, &iter,
1065                                             NAME_COLUMN, p->data,
1066                                             PREVIEW_COLUMN, pixbuf,
1067                                             DESCRIPTION_COLUMN, description,
1068                                             -1);
1069
1070                         g_object_unref (G_OBJECT (pixbuf));
1071                         g_free (description);
1072                 }
1073
1074                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
1075                 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
1076                 gtk_tree_selection_select_iter (selection, &iter);
1077
1078         }
1079         else
1080         {
1081                 /* Translators: "No match" means that for the given template search criteria, there
1082                  * were no matches found. */
1083                 this->priv->search_all_info_bar = gl_message_bar_new (GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, "%s", _("No match."));
1084                 gl_message_bar_format_secondary_text (GL_MESSAGE_BAR (this->priv->search_all_info_bar),
1085                                                       "%s", _("Try selecting a different brand, page size or category."));
1086
1087                 gtk_box_pack_start (GTK_BOX (this->priv->search_all_info_vbox),
1088                                     this->priv->search_all_info_bar,
1089                                     FALSE, FALSE, 0);
1090                 gtk_widget_show_all (this->priv->search_all_info_bar);
1091
1092                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
1093
1094         }
1095
1096         gl_debug (DEBUG_MEDIA_SELECT, "END");
1097 }
1098
1099
1100 /*--------------------------------------------------------------------------*/
1101 /* PRIVATE.  Load list store from template name list.                       */
1102 /*--------------------------------------------------------------------------*/
1103 static void
1104 load_custom_list (glMediaSelect      *this,
1105                   GtkListStore       *store,
1106                   GtkTreeSelection   *selection,
1107                   GList              *list)
1108 {
1109         GList            *p;
1110         GtkTreeIter       iter;
1111         lglUnits          units;
1112         lglTemplate      *template;
1113         lglTemplateFrame *frame;
1114         GdkPixbuf        *pixbuf;
1115         gchar            *size;
1116         gchar            *layout;
1117         gchar            *description;
1118
1119         gl_debug (DEBUG_MEDIA_SELECT, "START");
1120
1121         gtk_list_store_clear (store);
1122
1123
1124         if ( this->priv->custom_info_bar )
1125         {
1126                 gtk_container_remove (GTK_CONTAINER (this->priv->custom_info_vbox),
1127                                       this->priv->custom_info_bar);
1128                 this->priv->custom_info_bar = NULL;
1129         }
1130
1131         if (list)
1132         {
1133
1134                 units = gl_prefs_model_get_units (gl_prefs);
1135
1136                 for ( p=list; p!=NULL; p=p->next )
1137                 {
1138
1139                         gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data);
1140
1141                         template = lgl_db_lookup_template_from_name (p->data);
1142                         frame    = (lglTemplateFrame *)template->frames->data;
1143                         pixbuf   = gl_mini_preview_pixbuf_cache_get_pixbuf (p->data);
1144
1145                         size     = lgl_template_frame_get_size_description (frame, units);
1146                         layout   = lgl_template_frame_get_layout_description (frame);
1147                         description = g_strdup_printf ("<b>%s: %s</b>\n%s\n%s",
1148                                                        (gchar *)p->data,
1149                                                        template->description,
1150                                                        size,
1151                                                        layout);
1152                         g_free (size);
1153                         g_free (layout);
1154
1155                         lgl_template_free (template);
1156
1157                         gtk_list_store_append (store, &iter);
1158                         gtk_list_store_set (store, &iter,
1159                                             NAME_COLUMN, p->data,
1160                                             PREVIEW_COLUMN, pixbuf,
1161                                             DESCRIPTION_COLUMN, description,
1162                                             -1);
1163
1164                         g_object_unref (G_OBJECT (pixbuf));
1165                         g_free (description);
1166                 }
1167
1168                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
1169                 gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
1170                 gtk_tree_selection_select_iter (selection, &iter);
1171
1172                 gtk_widget_set_sensitive (GTK_WIDGET (this->priv->custom_edit_button), TRUE);
1173                 gtk_widget_set_sensitive (GTK_WIDGET (this->priv->custom_delete_button), TRUE);
1174         }
1175         else
1176         {
1177                 this->priv->custom_info_bar = gl_message_bar_new (GTK_MESSAGE_INFO,
1178                                                                           GTK_BUTTONS_NONE,
1179                                                                           "%s", _("No custom templates found."));
1180                 gl_message_bar_format_secondary_text (GL_MESSAGE_BAR (this->priv->custom_info_bar),
1181                                                       "%s", _("You may create new templates or try searching for pre-defined templates in the \"Search all\" tab."));
1182
1183                 gtk_box_pack_start (GTK_BOX (this->priv->custom_info_vbox),
1184                                     this->priv->custom_info_bar,
1185                                     FALSE, FALSE, 0);
1186                 gtk_widget_show_all (this->priv->custom_info_bar);
1187
1188                 gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
1189
1190                 gtk_widget_set_sensitive (GTK_WIDGET (this->priv->custom_edit_button), FALSE);
1191                 gtk_widget_set_sensitive (GTK_WIDGET (this->priv->custom_delete_button), FALSE);
1192         }
1193
1194         gl_debug (DEBUG_MEDIA_SELECT, "END");
1195 }
1196
1197
1198
1199 /*
1200  * Local Variables:       -- emacs
1201  * mode: C                -- emacs
1202  * c-basic-offset: 8      -- emacs
1203  * tab-width: 8           -- emacs
1204  * indent-tabs-mode: nil  -- emacs
1205  * End:                   -- emacs
1206  */