Taked Joni's widget and made it my own, also included it to style_browser.
[irreco.git] / irreco / trunk / src / core / irreco_style_browser_dlg.c
blobeaecaeabb469e809c31124f633560b8772e4ef57
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi),
4 * Harri Vattulainen (t5vaha01@students.oamk.fi)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "irreco_style_browser_dlg.h"
22 #include "irreco_scrolled_window.h"
23 #include <hildon/hildon-banner.h>
25 /**
26 * @typedef IrrecoStyleBrowser
28 * Dialog which displays a list of button styles to the user, so the user
29 * can select one.
32 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
33 /* Prototypes */
34 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
35 /*static gboolean
36 irreco_style_browser_dlg_loading_loop(IrrecoStyleBrowserDlgLoading *loading);*/
37 #if 0
38 static void irreco_style_browser_dlg_button_click(IrrecoButton *irreco_button,
39 IrrecoStyleBrowserDlg *self);
40 static gboolean irreco_style_browser_dlg_map_event(IrrecoStyleBrowserDlg *self,
41 GdkEvent *event,
42 gpointer user_data);
43 /*static gboolean
44 irreco_style_browser_dlg_configure_event(IrrecoStyleBrowserDlg *self,
45 GdkEventConfigure *event,
46 gpointer user_data);*/
47 static void irreco_style_browser_dlg_name_loading_start(IrrecoStyleBrowserDlg *self);
48 static void irreco_style_browser_dlg_row_selected_event(GtkTreeSelection *sel, IrrecoStyleBrowserDlg *self);
49 static gboolean irreco_style_browser_dlg_loading_loop_name(IrrecoStyleBrowserDlgLoading *loading);
50 static gboolean irreco_style_browser_dlg_loading_loop_pictures(IrrecoStyleBrowserDlgLoading *loading);
51 #endif
52 void irreco_style_browser_dlg_set_button_widget(IrrecoStyleBrowserDlg *self);
54 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
55 /* Construction & Destruction */
56 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
58 G_DEFINE_TYPE(IrrecoStyleBrowserDlg, irreco_style_browser_dlg, IRRECO_TYPE_DLG)
60 static void irreco_style_browser_dlg_finalize(GObject *object)
62 IRRECO_ENTER
63 G_OBJECT_CLASS(irreco_style_browser_dlg_parent_class)->finalize(object);
64 /*g_hash_table_destroy(IRRECO_STYLE_BROWSER_DLG(object)->layout_array);*/
65 IRRECO_RETURN
68 static void irreco_style_browser_dlg_class_init(IrrecoStyleBrowserDlgClass *klass)
70 GObjectClass *object_class = G_OBJECT_CLASS(klass);
71 object_class->finalize = irreco_style_browser_dlg_finalize;
75 #if 0
77 #endif
78 /* TODO heavy cleanup */
79 static void irreco_style_browser_dlg_init(IrrecoStyleBrowserDlg *self)
81 #if 0
82 GtkWidget *scrolled; /* Scrollable widget that holds button pictures */
83 GtkTreeSelection *select; /* Selected item of treeview */
84 GtkWidget *name_frame; /* frame around theme names, is inside self->hbox */
85 GtkWidget *pics_frame; /* frame around button pics, is inside self->hbox */
86 GtkWidget *name_alignment; /* inside frame, holds treeviewhbox */
87 GtkWidget *pics_alignment;
88 GtkWidget *scrolled_name; /* holds treeview, scrollbar and is inside alignment */
89 GtkWidget *padding;
90 #endif
91 /*IrrecoButtonBrowserWidget *button_widget;*/
92 IRRECO_ENTER
94 #if 0
95 /* Create array for irreco layouts. */
96 self->layout_array = g_hash_table_new_full(
97 g_direct_hash, g_direct_equal, NULL,
98 G_DESTROYNOTIFY(irreco_button_layout_destroy));
99 #endif
101 /* Construct dialog. */
102 gtk_window_set_title(GTK_WINDOW(self), _("Style Browser"));
103 gtk_window_set_modal(GTK_WINDOW(self), TRUE);
104 gtk_window_set_destroy_with_parent(GTK_WINDOW(self), TRUE);
105 gtk_dialog_set_has_separator(GTK_DIALOG(self), FALSE);
106 gtk_dialog_add_buttons(GTK_DIALOG(self),
107 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
108 NULL);
110 /*g_print("\n1\n");
111 self->button_widget = irreco_button_browser_widget_new(self->irreco_data);
112 g_print("\n2\n");*/
115 /*gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(self)->vbox),
116 GTK_WIDGET(self->button_widget));*/
118 #if 0
119 /* Create widgets. */
120 scrolled = irreco_scrolled_window_new_with_autoresize(400, 700, 200, 400);
121 scrolled_name = irreco_scrolled_window_new_with_autoresize(10, 700, 200, 400);
122 self->vbox = gtk_vbox_new(FALSE, 10);
123 self->vbox2 = gtk_vbox_new(FALSE, 10);
124 self->hbox = gtk_hbox_new(FALSE, 10);
126 /* Add padding */
127 padding = irreco_gtk_pad(self->vbox, 8, 8, 8, 8);
128 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(self)->vbox), padding);
131 pics_alignment = gtk_alignment_new(0, 0, 0.8, 0.8);
132 gtk_alignment_set_padding(GTK_ALIGNMENT(pics_alignment),
133 0, 8, 8, 8);
135 irreco_scrolled_window_add(IRRECO_SCROLLED_WINDOW(scrolled),
136 GTK_WIDGET(self->vbox2));
138 gtk_container_add(GTK_CONTAINER(pics_alignment),
139 GTK_WIDGET(scrolled));
141 /* Create frames and put inside self->hbox and add alignment */
142 name_frame = gtk_frame_new("");
143 gtk_frame_set_label_widget(GTK_FRAME(name_frame),
144 irreco_gtk_label_bold("Themes", 0, 0, 0, 0, 0, 0));
146 name_alignment = gtk_alignment_new(0, 0, 0, 0);
147 gtk_alignment_set_padding(GTK_ALIGNMENT(name_alignment),
148 0, 8, 8, 8);
149 gtk_container_add(GTK_CONTAINER(name_frame),
150 GTK_WIDGET(name_alignment));
152 gtk_container_add(GTK_CONTAINER(name_alignment),
153 GTK_WIDGET(scrolled_name));
155 gtk_box_pack_start(GTK_BOX(self->hbox),
156 GTK_WIDGET(name_frame),
157 FALSE, TRUE, 0);
160 pics_frame = gtk_frame_new("");
161 gtk_frame_set_label_widget(GTK_FRAME(pics_frame),
162 irreco_gtk_label_bold("Buttons", 0, 0, 0, 0, 0, 0));
164 gtk_box_pack_start(GTK_BOX(self->hbox),
165 GTK_WIDGET(pics_frame),
166 TRUE, TRUE, 0);
168 /*pics_alignment = gtk_alignment_new(0, 0, 0, 0);
169 gtk_alignment_set_padding(GTK_ALIGNMENT(pics_alignment),
170 0, 8, 8, 8);*/
171 gtk_container_add(GTK_CONTAINER(pics_frame),
172 GTK_WIDGET(pics_alignment));
175 self->listbox = IRRECO_LISTBOX(
176 irreco_listbox_text_new_with_autosize(0, 700, 100, 450));
178 irreco_scrolled_window_add(IRRECO_SCROLLED_WINDOW(scrolled_name),
179 GTK_WIDGET(self->listbox));
181 /* Add widgets to dialog. */
182 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(self)->vbox), GTK_WIDGET(self->hbox));
184 /* Setup the selection handler for list (TREE) */
185 select = gtk_tree_view_get_selection(GTK_TREE_VIEW(self->listbox->tree_view));
186 gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
188 /* Signal handlers. */
189 g_signal_connect(G_OBJECT(self), "map-event",
190 G_CALLBACK(irreco_style_browser_dlg_map_event), NULL);
192 g_signal_connect(G_OBJECT (select), "changed",
193 G_CALLBACK (irreco_style_browser_dlg_row_selected_event),
194 self);
195 #endif
196 /* Show dialog, hopefully on the left-top corner of the screen. */
197 gtk_widget_show_all(GTK_WIDGET(self));
198 g_print("\n3\n");
199 gtk_window_move(GTK_WINDOW(self), 80, 60);
200 IRRECO_RETURN
204 GtkWidget* irreco_style_browser_dlg_new(IrrecoData *irreco_data,
205 GtkWindow *parent)
207 IrrecoStyleBrowserDlg *self;
208 IRRECO_ENTER
209 g_print("\nn1\n");
210 self = g_object_new(IRRECO_TYPE_STYLE_BROWSER_DLG, NULL);
211 g_print("\nn2\n");
212 irreco_dlg_set_parent(IRRECO_DLG(self), parent);
213 g_print("\nn3\n");
214 irreco_style_browser_dlg_set_irreco_data(self, irreco_data);
215 irreco_style_browser_dlg_set_button_widget(self);
216 IRRECO_RETURN_PTR(self);
221 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
222 /* Private Functions */
223 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
224 #if 0
225 static void irreco_style_browser_dlg_add_style(IrrecoStyleBrowserDlg *self,
226 IrrecoButtonStyle *style)
228 GtkWidget *label;
229 GtkWidget *hbox;
230 GtkWidget *fixed;
231 IrrecoButtonLayout *layout;
232 IRRECO_ENTER
234 /* Create widgets. */
235 if (style == NULL) {
236 label = gtk_label_new(_("Normal button"));
237 } else {
238 label = gtk_label_new(style->name);
240 hbox = gtk_hbox_new(FALSE, 10);
241 fixed = gtk_fixed_new();
243 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
244 gtk_box_pack_start(GTK_BOX(hbox), fixed, 0, 0, 0);
245 gtk_box_pack_end_defaults(GTK_BOX(hbox), label);
246 gtk_container_add(GTK_CONTAINER(self->vbox2), hbox);
247 gtk_widget_show_all(hbox);
249 /* Create layout and setup callbacks. */
250 layout = irreco_button_layout_create(fixed, NULL);
251 g_hash_table_insert(self->layout_array, layout, layout);
252 irreco_button_layout_set_press_callback(layout, irreco_button_down);
253 irreco_button_layout_set_release_callback(
254 layout, irreco_style_browser_dlg_button_click);
255 irreco_button_layout_set_callback_data(layout, self);
257 /* Create button. */
258 irreco_button_create(layout, 0, 0, _("Select"), style, NULL);
259 irreco_button_layout_create_widgets(layout);
260 IRRECO_RETURN
262 #endif
263 /* TODO replace by irreco_style_browser_dlg_name_loading_start */
264 #if 0
265 static void irreco_style_browser_dlg_loading_start(IrrecoStyleBrowserDlg *self)
267 IRRECO_ENTER
269 if (self->loading == NULL) {
270 self->loading = g_slice_new0(IrrecoStyleBrowserDlgLoading);
271 self->loading->self = self;
272 self->loading->len = irreco_string_table_lenght(
273 self->irreco_data->button_style_array);
274 self->loading->banner = hildon_banner_show_progress(
275 GTK_WIDGET(self), NULL, "Loading");
276 hildon_banner_set_fraction(HILDON_BANNER(self->loading->banner),
277 (float) 1 / (float) self->loading->len);
278 g_hash_table_remove_all(self->layout_array);
280 /* Add GtkButton layout. */
281 irreco_style_browser_dlg_add_style(self, NULL);
282 g_idle_add(G_SOURCEFUNC(irreco_style_browser_dlg_loading_loop),
283 self->loading);
285 IRRECO_RETURN
287 #endif
289 static void irreco_style_browser_dlg_loading_cancel(IrrecoStyleBrowserDlg *self)
291 IRRECO_ENTER
292 if (self->loading != NULL) self->loading->self = NULL;
293 IRRECO_RETURN
296 #if 0
297 /* TODO orig */
298 static gboolean
299 irreco_style_browser_dlg_loading_loop(IrrecoStyleBrowserDlgLoading *loading)
301 const gchar *key;
302 gpointer style;
303 IRRECO_ENTER
305 /* Use has closed the dialog before the loading has been completed.
306 When we hit this, Gtk has already destroyed the dialog, so all we
307 need to do is to realease the loading strucure.*/
308 if (loading->self == NULL) {
309 IRRECO_DEBUG("Cancelling style loading.\n");
310 g_slice_free(IrrecoStyleBrowserDlgLoading, loading);
311 IRRECO_RETURN_BOOL(FALSE);
313 } else if (irreco_string_table_index(
314 loading->self->irreco_data->button_style_array,
315 loading->pos, &key, &style)) {
316 IRRECO_DEBUG("Loading style \"%s\".\n", key);
317 irreco_style_browser_dlg_add_style(loading->self,
318 (IrrecoButtonStyle *) style);
319 loading->pos = loading->pos + 1;
320 hildon_banner_set_fraction(HILDON_BANNER(loading->banner),
321 (float) 1 / (float) loading->len
322 * (float) loading->pos);
323 IRRECO_RETURN_BOOL(TRUE);
325 } else {
326 IRRECO_DEBUG("Loading complete. Cleaning up.\n");
327 gtk_widget_destroy(loading->banner);
328 loading->self->loading = NULL;
329 loading->banner = NULL;
330 loading->pos = 0;
331 g_slice_free(IrrecoStyleBrowserDlgLoading, loading);
332 IRRECO_RETURN_BOOL(FALSE);
335 #endif
336 #if 0
337 /* TODO */
338 /* Start loading names to treeview */
339 /* Really done like this? Look example somewhere */
340 static void irreco_style_browser_dlg_name_loading_start(IrrecoStyleBrowserDlg *self)
342 IRRECO_ENTER
344 g_print("\nlengHT\n%d\n\n", irreco_string_table_lenght(self->irreco_data->theme_manager->themes));
346 if (self->loading == NULL) {
347 self->loading = g_slice_new0(IrrecoStyleBrowserDlgLoading);
348 self->loading->self = self;
349 self->loading->len = irreco_string_table_lenght(
350 self->irreco_data->theme_manager->themes);
351 self->loading->banner = hildon_banner_show_progress(
352 GTK_WIDGET(self), NULL, "Loading");
353 hildon_banner_set_fraction(HILDON_BANNER(self->loading->banner),
354 (float) 1 / (float) self->loading->len);
355 g_hash_table_remove_all(self->layout_array);
357 /* Add GtkButton layout. */
358 /*irreco_style_browser_dlg_add_style(self, NULL);*/
359 g_idle_add(G_SOURCEFUNC(irreco_style_browser_dlg_loading_loop_name),
360 self->loading);
362 IRRECO_RETURN
365 /* Called when theme name is selected */
366 /* Start loading button pictures to "scrolled" */
367 static void irreco_style_browser_dlg_button_loading_start(IrrecoStyleBrowserDlg *self)
369 IRRECO_ENTER
371 if (self->loading == NULL) {
372 self->loading = g_slice_new0(IrrecoStyleBrowserDlgLoading);
373 self->loading->self = self;
374 /*self->loading->len = irreco_string_table_lenght(
375 self->irreco_data->button_style_array);*/
376 self->loading->len = irreco_string_table_lenght(
377 self->loading->self->buttons_table);
378 self->loading->banner = hildon_banner_show_progress(
379 GTK_WIDGET(self), NULL, "Loading");
380 hildon_banner_set_fraction(HILDON_BANNER(self->loading->banner),
381 (float) 1 / (float) self->loading->len);
383 /* TODO FIXME Clear button array, neither works */
384 /*g_hash_table_unref(self->layout_array);
385 self->layout_array = g_hash_table_new_full(
386 g_direct_hash, g_direct_equal, NULL,
387 G_DESTROYNOTIFY(irreco_button_layout_destroy));*/
388 /*g_hash_table_remove_all(self->layout_array);*/
390 /* TODO FIXME Creates default button, that should be at default theme */
391 /* In case of no themes installed happens wut? */
392 /* Add GtkButton layout. */
393 /*irreco_style_browser_dlg_add_style(self, NULL);*/
395 g_hash_table_remove_all(self->layout_array);
397 g_idle_add(G_SOURCEFUNC(irreco_style_browser_dlg_loading_loop_pictures),
398 self->loading);
400 IRRECO_RETURN
404 /* */
405 static gboolean
406 irreco_style_browser_dlg_loading_loop_name(IrrecoStyleBrowserDlgLoading *loading)
408 const gchar *key;
409 gpointer style;
410 IRRECO_ENTER
412 /* UseR has closed the dialog before the loading has been completed.
413 When we hit this, Gtk has already destroyed the dialog, so all we
414 need to do is to re_lease the loading strucTure.*/
415 if (loading->self == NULL) {
416 IRRECO_DEBUG("Cancelling theme name loading.\n");
417 g_slice_free(IrrecoStyleBrowserDlgLoading, loading);
418 IRRECO_RETURN_BOOL(FALSE);
420 } else if (irreco_string_table_index(
421 loading->self->irreco_data->theme_manager->themes,
422 loading->pos, &key, &style)) {
423 GString *str = g_string_new(NULL);
424 IRRECO_DEBUG("Loading theme name \"%s\".\n", key);
425 g_string_append_printf(str, "%s", key);
426 irreco_listbox_text_append(IRRECO_LISTBOX_TEXT(
427 loading->self->listbox),
428 str->str, loading->self->irreco_data);
430 loading->pos = loading->pos + 1;
431 hildon_banner_set_fraction(HILDON_BANNER(loading->banner),
432 (float) 1 / (float) loading->len
433 * (float) loading->pos);
435 IRRECO_RETURN_BOOL(TRUE);
437 } else {
438 IRRECO_DEBUG("Loading theme name complete. Cleaning up.\n");
439 gtk_widget_destroy(loading->banner);
440 loading->self->loading = NULL;
441 loading->banner = NULL;
442 loading->pos = 0;
443 g_slice_free(IrrecoStyleBrowserDlgLoading, loading);
444 IRRECO_RETURN_BOOL(FALSE);
448 /* TODO */
449 /* */
450 static gboolean
451 irreco_style_browser_dlg_loading_loop_pictures(IrrecoStyleBrowserDlgLoading *loading)
453 const gchar *key;
454 IrrecoThemeButton *style;
455 IrrecoButtonStyle *oldstyle = NULL;
456 IRRECO_ENTER
457 oldstyle = g_slice_new0(IrrecoButtonStyle);
458 /* Use has closed the dialog before the loading has been completed.
459 When we hit this, Gtk has already destroyed the dialog, so all we
460 need to do is to realease the loading strucure.*/
461 if (loading->self == NULL) {
462 IRRECO_DEBUG("Cancelling buttons loading.\n");
463 g_slice_free(IrrecoStyleBrowserDlgLoading, loading);
464 IRRECO_RETURN_BOOL(FALSE);
466 } else if (irreco_string_table_index(
467 loading->self->buttons_table,
468 loading->pos, &key, (gpointer *)&style)){
469 /* Print identical and valid key and button name */
470 IRRECO_DEBUG("Loading button \"%s\".\n", key);
471 IRRECO_DEBUG("Button name \"%s\".\n", style->name->str);
473 oldstyle->name = style->name->str;
474 oldstyle->up = style->image_up->str;
475 oldstyle->down = style->image_down->str;
476 oldstyle->text_format_up = style->text_format_up->str;
477 oldstyle->text_format_down = style->text_format_down->str;
478 oldstyle->allow_text = style->allow_text;
479 oldstyle->text_padding = style->text_padding;
480 irreco_style_browser_dlg_add_style(loading->self,
481 (IrrecoButtonStyle *) oldstyle);
482 loading->pos = loading->pos + 1;
483 hildon_banner_set_fraction(HILDON_BANNER(loading->banner),
484 (float) 1 / (float) loading->len
485 * (float) loading->pos);
486 IRRECO_RETURN_BOOL(TRUE);
488 } else {
489 IRRECO_DEBUG("Loading buttons complete. Cleaning up.\n");
490 gtk_widget_destroy(loading->banner);
491 loading->self->loading = NULL;
492 loading->banner = NULL;
493 loading->pos = 0;
494 g_slice_free(IrrecoStyleBrowserDlgLoading, loading);
495 IRRECO_RETURN_BOOL(FALSE);
498 #endif
502 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
503 /* Functions */
504 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
506 void irreco_style_browser_dlg_set_irreco_data(IrrecoStyleBrowserDlg *self,
507 IrrecoData *irreco_data)
509 IRRECO_ENTER
510 self->irreco_data = irreco_data;
511 IRRECO_RETURN
514 void irreco_style_browser_dlg_set_button_widget(IrrecoStyleBrowserDlg *self)
516 IRRECO_ENTER
518 self->button_widget = irreco_button_browser_widget_new(self->irreco_data);
520 gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(self)->vbox),
521 GTK_WIDGET(self->button_widget));
522 g_print("\n3n\n");
523 /* Signal handlers. */
524 /*g_signal_connect(G_OBJECT(self), "map-event",
525 G_CALLBACK(irreco_style_browser_dlg_map_event), NULL);*/
526 gtk_widget_show_all(GTK_WIDGET(self));
528 IRRECO_RETURN
531 gboolean irreco_show_style_browser_dlg(IrrecoData *irreco_data,
532 GtkWindow *parent,
533 IrrecoButtonStyle **style)
535 gint response;
536 IrrecoStyleBrowserDlg *self;
537 IRRECO_ENTER
539 self = IRRECO_STYLE_BROWSER_DLG(irreco_style_browser_dlg_new(
540 irreco_data, parent));
541 response = gtk_dialog_run(GTK_DIALOG(self));
542 irreco_style_browser_dlg_loading_cancel(self);
544 if (response == 1) *style = self->style;
545 gtk_widget_destroy(GTK_WIDGET(self));
547 if (response == 1) IRRECO_RETURN_BOOL(TRUE);
548 IRRECO_RETURN_BOOL(FALSE);
553 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
554 /* Events and Callbacks */
555 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
556 /* TODO TODO TODO enable and add signal handler to this */
557 #if 0
558 static void irreco_style_browser_dlg_button_click(IrrecoButton *irreco_button,
559 IrrecoStyleBrowserDlg *self)
561 IRRECO_ENTER
562 self->style = irreco_button->style;
563 gtk_dialog_response(GTK_DIALOG(self), 1);
564 IRRECO_RETURN
566 #endif
567 /* TODO remove */
568 /* orig */
569 /*static gboolean irreco_style_browser_dlg_map_event(IrrecoStyleBrowserDlg *self,
570 GdkEvent *event,
571 gpointer user_data)
573 IRRECO_ENTER
574 irreco_style_browser_dlg_loading_start(self);
575 IRRECO_RETURN_BOOL(FALSE);
579 /* Dialog is shown so start loading theme names by calling ...name_loading_start */
580 #if 0
581 static gboolean irreco_style_browser_dlg_map_event(IrrecoStyleBrowserDlg *self,
582 GdkEvent *event,
583 gpointer user_data)
585 IRRECO_ENTER
586 irreco_style_browser_dlg_name_loading_start(self);
587 IRRECO_RETURN_BOOL(FALSE);
591 /* TODO */
592 /* Handling signal that is emitted when theme name is clicked, this calls
593 irreco_style_browser_dlg_button_loading_start which resets everything and
594 starts idling through pictures at irreco_style_browser_dlg_loading_loop_pictures */
595 static void irreco_style_browser_dlg_row_selected_event(GtkTreeSelection *selection,
596 IrrecoStyleBrowserDlg *self)
598 /*irreco_style_browser_dlg_button_loading_start(self);*/
600 gchar *sel_label = NULL;
601 /*IrrecoStringTable *buttons_table;*/
602 /*GtkTreeIter iter;
603 GtkTreeModel *model;
604 gchar *theme_name;*/
606 IRRECO_ENTER
609 irreco_listbox_get_selection(IRRECO_LISTBOX(self->listbox),
610 NULL, &sel_label, NULL);
611 g_print("\n laabeli: %s\n\n", sel_label);
613 self->buttons_table = irreco_theme_manager_get_buttons(self->irreco_data->theme_manager, sel_label);
616 /* Sets iter to the currently selected node */
617 /*if (gtk_tree_selection_get_selected (sel, &model, &iter))
619 if(&iter == NULL) { g_print("\niter on null\n"); }
620 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 0, &theme_name, -1);
621 g_print("\nteeman nimi: %s \n\n", theme_name);
622 IRRECO_PAUSE
626 if(TRUE) irreco_style_browser_dlg_button_loading_start(self);
628 IRRECO_RETURN
630 #endif
634 static gboolean
635 irreco_style_browser_dlg_configure_event(IrrecoStyleBrowserDlg *self,
636 GdkEventConfigure *event,
637 gpointer user_data)
639 IRRECO_ENTER
640 IRRECO_PRINTF("Dialog position x%i y%i\n", event->x, event->y);
641 IRRECO_RETURN_BOOL(FALSE);