From f6bf711c4ce4940800ab876b4299c238290825a9 Mon Sep 17 00:00:00 2001 From: Harri Vattulainen Date: Tue, 19 Aug 2008 06:56:09 +0000 Subject: [PATCH] Taked Joni's widget and made it my own, also included it to style_browser. Committing to get signal handler example. --- irreco/trunk/src/core/irreco_background_dlg.c | 4 +- irreco/trunk/src/core/irreco_background_dlg.h | 2 +- .../trunk/src/core/irreco_button_browser_widget.c | 182 ++++++++++----------- .../trunk/src/core/irreco_button_browser_widget.h | 10 +- irreco/trunk/src/core/irreco_style_browser_dlg.c | 67 ++++++-- irreco/trunk/src/core/irreco_style_browser_dlg.h | 9 +- 6 files changed, 159 insertions(+), 115 deletions(-) diff --git a/irreco/trunk/src/core/irreco_background_dlg.c b/irreco/trunk/src/core/irreco_background_dlg.c index a27d63d9..833c80f5 100644 --- a/irreco/trunk/src/core/irreco_background_dlg.c +++ b/irreco/trunk/src/core/irreco_background_dlg.c @@ -114,10 +114,10 @@ IrrecoBackgroundDlg *irreco_background_dlg_create(IrrecoData *irreco_data, GTK_WIDGET(self->theme_bg_browser), gtk_label_new("Theme")); /* Buttons page */ - self->theme_button_browser = irreco_button_browser_widget_new(irreco_data); + /*self->theme_button_browser = irreco_button_browser_widget_new(irreco_data); gtk_notebook_append_page(GTK_NOTEBOOK(self->notebook), self->theme_button_browser, - gtk_label_new("Button")); + gtk_label_new("Button"));*/ gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(self->dialog)->vbox), self->notebook); diff --git a/irreco/trunk/src/core/irreco_background_dlg.h b/irreco/trunk/src/core/irreco_background_dlg.h index 35ef5a66..1977c240 100644 --- a/irreco/trunk/src/core/irreco_background_dlg.h +++ b/irreco/trunk/src/core/irreco_background_dlg.h @@ -59,7 +59,7 @@ struct _IrrecoBackgroundDlg { GtkWidget *radio_image; GtkWidget *notebook; IrrecoBgBrowserWidget *theme_bg_browser; - GtkWidget *theme_button_browser; + /*GtkWidget *theme_button_browser;*/ IrrecoButtonLayoutBgType type; GString *filename; }; diff --git a/irreco/trunk/src/core/irreco_button_browser_widget.c b/irreco/trunk/src/core/irreco_button_browser_widget.c index a468a5d7..2c4a1315 100644 --- a/irreco/trunk/src/core/irreco_button_browser_widget.c +++ b/irreco/trunk/src/core/irreco_button_browser_widget.c @@ -26,50 +26,46 @@ G_DEFINE_TYPE (IrrecoButtonBrowserWidget, irreco_button_browser_widget, GTK_TYPE /** * @addtogroup IrrecoButtonBrowserWidget * - * This widget helps selection of button. + * This widget helps selection of background. * - * This widget allows button selection from themes - * @{ @file - * Source file of @ref IrrecoButtonBrowserWidget. + * This widget allows background selection from themes + * @{ */ - +/** + * @file + * Source file of @ref IrrecoButtonBrowserWidget. + */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Prototypes */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ -static void irreco_button_browser_widget_destroy_event(IrrecoButtonBrowserWidget *self, - gpointer user_data); - -void irreco_button_browser_widget_selection_changed(GtkTreeSelection * selection, - IrrecoButtonBrowserWidget *self); -void irreco_button_browser_widget_row_activated(GtkTreeView *tree_view, - GtkTreePath *path, - GtkTreeViewColumn *column, - IrrecoButtonBrowserWidget *self); - static gboolean irreco_button_browser_widget_populate_themes( IrrecoButtonBrowserWidget *self); + static gboolean irreco_button_browser_widget_loader_images( IrrecoButtonBrowserWidget *self); -static void irreco_button_browser_widget_loader_start(IrrecoButtonBrowserWidget *self, + +static void irreco_button_browser_widget_loader_start(IrrecoButtonBrowserWidget *self, GSourceFunc function, GtkTreeIter *parent_iter); -/*static gboolean irreco_button_browser_widget_loader(IrrecoButtonBrowserWidget *self);*/ + +static void irreco_button_browser_widget_destroy_event(IrrecoButtonBrowserWidget *self, + gpointer user_data); + +static void irreco_button_browser_widget_theme_selection_changed( + GtkTreeSelection * selection, + IrrecoButtonBrowserWidget *self); + +static void irreco_button_browser_widget_image_selection_changed( + GtkTreeSelection * selection, + IrrecoButtonBrowserWidget *self); + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Datatypes */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ -/** GtkTreeStore colums. */ -enum -{ - TEXT_COL, - FLAG_COL, - DATA_COL, - N_COLUMNS -}; - /** Loader states. */ enum { @@ -79,24 +75,13 @@ enum LOADER_STATE_CLEANUP }; -/** Row flags. */ -enum -{ - ROW_CHILDREN_LOADED = 1 << 1, - ROW_TYPE_CATEGORY = 1 << 2, - ROW_TYPE_MANUFACTURER = 1 << 3, - ROW_TYPE_MODEL = 1 << 4, - ROW_TYPE_CONFIG = 1 << 5, - ROW_TYPE_LOADING = 1 << 6 -}; - /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Construction & Destruction */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /** - * @name Construction & Destruction - * @{ + * @name Construction & Destruction + * @{ */ static void irreco_button_browser_widget_finalize (GObject *object) @@ -122,13 +107,12 @@ static void irreco_button_browser_widget_class_init(IrrecoButtonBrowserWidgetCla static void irreco_button_browser_widget_init (IrrecoButtonBrowserWidget *self) { - /*GtkTreeSelection *select;*/ - GtkWidget *frame_for_themes; GtkWidget *frame_for_images; IRRECO_ENTER self->current_theme = g_string_new(""); + self->current_image = NULL; /* Create themes */ @@ -144,40 +128,35 @@ static void irreco_button_browser_widget_init (IrrecoButtonBrowserWidget *self) gtk_container_add(GTK_CONTAINER(frame_for_themes), GTK_WIDGET(self->themes)); - /* Create Images */ /* Create frame for Images */ - frame_for_images = gtk_frame_new(""); + frame_for_images = gtk_frame_new(""); gtk_frame_set_label_widget(GTK_FRAME(frame_for_images), - irreco_gtk_label_bold("Buttons", 0, 0, 0, 0, 0, 0)); - + irreco_gtk_label_bold("Images", 0, 0, 0, 0, 0, 0)); /* Create list of images */ + /* TODO autosize? */ self->images = IRRECO_LISTBOX_IMAGE( irreco_listbox_image_new_with_autosize(400, 400, 200, 200)); + irreco_listbox_set_select_new_rows(IRRECO_LISTBOX(self->images), FALSE); gtk_container_add(GTK_CONTAINER(frame_for_images), GTK_WIDGET(self->images)); - - - /* Setup the selection handler for TREE */ - /*select = gtk_tree_view_get_selection( - IRRECO_LISTBOX(self->themes)->tree_view); - gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);*/ /* Signal handlers. */ g_signal_connect(G_OBJECT(self), "destroy", - G_CALLBACK(irreco_button_browser_widget_destroy_event), NULL); + G_CALLBACK(irreco_button_browser_widget_destroy_event), NULL); + + g_signal_connect(G_OBJECT(IRRECO_LISTBOX(self->themes)->tree_selection), + "changed", + G_CALLBACK(irreco_button_browser_widget_theme_selection_changed), + self); - g_signal_connect(G_OBJECT(IRRECO_LISTBOX(self->themes)->tree_selection), - "changed", - G_CALLBACK(irreco_button_browser_widget_selection_changed), - self); - g_signal_connect(G_OBJECT(IRRECO_LISTBOX(self->themes)->tree_view), - "row-activated", - G_CALLBACK(irreco_button_browser_widget_row_activated), - self); + g_signal_connect(G_OBJECT(IRRECO_LISTBOX(self->images)->tree_selection), + "changed", + G_CALLBACK(irreco_button_browser_widget_image_selection_changed), + self); /* Create hbox */ self->hbox = g_object_new(GTK_TYPE_HBOX, NULL); @@ -192,10 +171,10 @@ static void irreco_button_browser_widget_init (IrrecoButtonBrowserWidget *self) gtk_box_pack_start(GTK_BOX(self), GTK_WIDGET(self->hbox), FALSE, TRUE, 0); - IRRECO_RETURN; + IRRECO_RETURN } -GtkWidget* irreco_button_browser_widget_new(IrrecoData *irreco_data) +IrrecoButtonBrowserWidget *irreco_button_browser_widget_new(IrrecoData *irreco_data) { IrrecoButtonBrowserWidget *self; IrrecoStringTable *themes = irreco_data->theme_manager->themes; @@ -207,10 +186,11 @@ GtkWidget* irreco_button_browser_widget_new(IrrecoData *irreco_data) self->irreco_data = irreco_data; if (irreco_string_table_lenght(themes) > 0) { - + const gchar *theme_name; irreco_button_browser_widget_populate_themes(self); irreco_listbox_set_selection(IRRECO_LISTBOX(self->themes), 0); + irreco_string_table_index(themes, 0, &theme_name, NULL); g_string_printf(self->current_theme, "%s", theme_name); @@ -225,14 +205,12 @@ GtkWidget* irreco_button_browser_widget_new(IrrecoData *irreco_data) /** @} */ - - /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Private Functions */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /** * @name Private Functions - * @{ + * @{ */ /** @@ -245,15 +223,15 @@ GtkWidget* irreco_button_browser_widget_new(IrrecoData *irreco_data) * @param fraction Value of progress. */ static void irreco_button_browser_widget_set_banner(IrrecoButtonBrowserWidget *self, - const gchar *text, - gdouble fraction) + const gchar *text, + gdouble fraction) { IRRECO_ENTER if (self->banner == NULL) { self->banner = hildon_banner_show_progress( GTK_WIDGET(self), NULL, ""); } - + hildon_banner_set_text(HILDON_BANNER(self->banner), text); hildon_banner_set_fraction(HILDON_BANNER(self->banner), fraction); IRRECO_RETURN @@ -275,12 +253,12 @@ static void irreco_button_browser_widget_hide_banner(IrrecoButtonBrowserWidget * /** * Start a loader state machine if one is not running already. */ -static void irreco_button_browser_widget_loader_start(IrrecoButtonBrowserWidget *self, +static void irreco_button_browser_widget_loader_start(IrrecoButtonBrowserWidget *self, GSourceFunc function, GtkTreeIter *parent_iter) { IRRECO_ENTER - + if (self->loader_func_id == 0) { #if 0 if (parent_iter) { @@ -295,7 +273,7 @@ static void irreco_button_browser_widget_loader_start(IrrecoButtonBrowserWidget IRRECO_ERROR("Loader function pointer not given.\n"); } } - + IRRECO_RETURN } @@ -311,7 +289,7 @@ static void irreco_button_browser_widget_loader_stop(IrrecoButtonBrowserWidget * self->loader_state = 0; #if 0 if (self->loader_parent_iter) { - gtk_tree_iter_free(self->loader_parent_iter); + gtk_tree_iter_free(self->loader_parent_iter); } self->loader_parent_iter = NULL; #endif @@ -319,7 +297,6 @@ static void irreco_button_browser_widget_loader_stop(IrrecoButtonBrowserWidget * IRRECO_RETURN } - /** * Theme loader. * @@ -378,23 +355,24 @@ static gboolean irreco_button_browser_widget_loader_images( self->current_theme->str, (gpointer *) &theme); - theme_button_count = irreco_string_table_lenght(theme->buttons); + theme_button_count = irreco_string_table_lenght(theme->backgrounds); if (theme_button_count > 0) { - IrrecoThemeButton *button_image; - irreco_string_table_index(theme->buttons, + IrrecoThemeBg *background_image; + irreco_string_table_index(theme->backgrounds, self->loader_index, &image_name, - (gpointer *) &button_image); + (gpointer *) &background_image); - irreco_listbox_image_append(self->images, - button_image->name->str, - button_image, - button_image->image_up->str); + irreco_listbox_image_append(self->images, + background_image->image_name->str, + background_image, + background_image->image_path->str); } else { - irreco_listbox_image_append(self->images, + /*irreco_listbox_image_append(self->images, "Empty imagelist", - NULL, ""); + NULL, "");*/ + self->current_image = NULL; theme_button_count = 1; } @@ -420,15 +398,13 @@ static gboolean irreco_button_browser_widget_loader_images( /** @} */ - - /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Public Functions */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /** * @name Public Functions - * @{ + * @{ */ /* Add functions here. */ @@ -441,7 +417,7 @@ static gboolean irreco_button_browser_widget_loader_images( /** * @name Events and Callbacks - * @{ + * @{ */ static void irreco_button_browser_widget_destroy_event(IrrecoButtonBrowserWidget *self, @@ -452,7 +428,8 @@ static void irreco_button_browser_widget_destroy_event(IrrecoButtonBrowserWidget IRRECO_RETURN } -void irreco_button_browser_widget_selection_changed(GtkTreeSelection *selection, +static void irreco_button_browser_widget_theme_selection_changed( + GtkTreeSelection *selection, IrrecoButtonBrowserWidget *self) { gint sel_index = -1; @@ -460,7 +437,11 @@ void irreco_button_browser_widget_selection_changed(GtkTreeSelection *selection, gpointer sel_user_data = NULL; IRRECO_ENTER - irreco_listbox_get_selection(IRRECO_LISTBOX(self->themes), + if (self->loader_func_id != 0) { + irreco_button_browser_widget_loader_stop(self); + } + + irreco_listbox_get_selection(IRRECO_LISTBOX(self->themes), &sel_index, &sel_label, &sel_user_data); g_string_printf(self->current_theme, "%s", sel_label); @@ -468,17 +449,30 @@ void irreco_button_browser_widget_selection_changed(GtkTreeSelection *selection, irreco_button_browser_widget_loader_start(self, G_SOURCEFUNC(irreco_button_browser_widget_loader_images), NULL); + g_free(sel_label); IRRECO_RETURN } -void irreco_button_browser_widget_row_activated(GtkTreeView *tree_view, - GtkTreePath *path, - GtkTreeViewColumn *column, - IrrecoButtonBrowserWidget *self) +static void irreco_button_browser_widget_image_selection_changed( + GtkTreeSelection *selection, + IrrecoButtonBrowserWidget *self) { + gint sel_index = -1; + gchar *sel_label = NULL; + IrrecoThemeBg *bg = NULL; IRRECO_ENTER + + if (irreco_listbox_get_selection(IRRECO_LISTBOX(self->images), + &sel_index, &sel_label, (gpointer *)&bg)) { + self->current_image = bg; + } else { + self->current_image = NULL; + } + + g_free(sel_label); IRRECO_RETURN } + /** @} */ /** @} */ diff --git a/irreco/trunk/src/core/irreco_button_browser_widget.h b/irreco/trunk/src/core/irreco_button_browser_widget.h index 936af7ec..864d1448 100644 --- a/irreco/trunk/src/core/irreco_button_browser_widget.h +++ b/irreco/trunk/src/core/irreco_button_browser_widget.h @@ -20,7 +20,11 @@ /** * @addtogroup IrrecoButtonBrowserWidget - * @{ @file + * @{ + */ + +/** + * @file * Header file of @ref IrrecoButtonBrowserWidget. */ @@ -89,11 +93,13 @@ struct _IrrecoButtonBrowserWidget { IrrecoListboxText *themes; IrrecoListboxImage *images; GString *current_theme; + IrrecoThemeBg *current_image; GtkWidget *banner; GtkWidget *hbox; gint loader_index; gint loader_state; gint loader_func_id; + }; struct _IrrecoButtonBrowserWidgetClass { @@ -112,7 +118,7 @@ struct _IrrecoButtonBrowserWidgetClass { /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ GType irreco_button_browser_widget_get_type(void); -GtkWidget* irreco_button_browser_widget_new(IrrecoData *irreco_data); +IrrecoButtonBrowserWidget *irreco_button_browser_widget_new(IrrecoData *irreco_data); void irreco_button_browser_widget_destroy(IrrecoButtonBrowserWidget * self); #endif /* __IRRECO_BUTTON_BROWSER_WIDGET_H__ */ diff --git a/irreco/trunk/src/core/irreco_style_browser_dlg.c b/irreco/trunk/src/core/irreco_style_browser_dlg.c index dc8d341b..eaecaeab 100644 --- a/irreco/trunk/src/core/irreco_style_browser_dlg.c +++ b/irreco/trunk/src/core/irreco_style_browser_dlg.c @@ -34,6 +34,7 @@ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /*static gboolean irreco_style_browser_dlg_loading_loop(IrrecoStyleBrowserDlgLoading *loading);*/ +#if 0 static void irreco_style_browser_dlg_button_click(IrrecoButton *irreco_button, IrrecoStyleBrowserDlg *self); static gboolean irreco_style_browser_dlg_map_event(IrrecoStyleBrowserDlg *self, @@ -47,7 +48,8 @@ static void irreco_style_browser_dlg_name_loading_start(IrrecoStyleBrowserDlg *s static void irreco_style_browser_dlg_row_selected_event(GtkTreeSelection *sel, IrrecoStyleBrowserDlg *self); static gboolean irreco_style_browser_dlg_loading_loop_name(IrrecoStyleBrowserDlgLoading *loading); static gboolean irreco_style_browser_dlg_loading_loop_pictures(IrrecoStyleBrowserDlgLoading *loading); - +#endif +void irreco_style_browser_dlg_set_button_widget(IrrecoStyleBrowserDlg *self); /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Construction & Destruction */ @@ -59,7 +61,7 @@ static void irreco_style_browser_dlg_finalize(GObject *object) { IRRECO_ENTER G_OBJECT_CLASS(irreco_style_browser_dlg_parent_class)->finalize(object); - g_hash_table_destroy(IRRECO_STYLE_BROWSER_DLG(object)->layout_array); + /*g_hash_table_destroy(IRRECO_STYLE_BROWSER_DLG(object)->layout_array);*/ IRRECO_RETURN } @@ -73,9 +75,10 @@ static void irreco_style_browser_dlg_class_init(IrrecoStyleBrowserDlgClass *klas #if 0 #endif -/* TODO FIXME roll back to previous version */ +/* TODO heavy cleanup */ static void irreco_style_browser_dlg_init(IrrecoStyleBrowserDlg *self) { +#if 0 GtkWidget *scrolled; /* Scrollable widget that holds button pictures */ GtkTreeSelection *select; /* Selected item of treeview */ GtkWidget *name_frame; /* frame around theme names, is inside self->hbox */ @@ -84,13 +87,16 @@ static void irreco_style_browser_dlg_init(IrrecoStyleBrowserDlg *self) GtkWidget *pics_alignment; GtkWidget *scrolled_name; /* holds treeview, scrollbar and is inside alignment */ GtkWidget *padding; +#endif + /*IrrecoButtonBrowserWidget *button_widget;*/ IRRECO_ENTER - +#if 0 /* Create array for irreco layouts. */ self->layout_array = g_hash_table_new_full( g_direct_hash, g_direct_equal, NULL, G_DESTROYNOTIFY(irreco_button_layout_destroy)); +#endif /* Construct dialog. */ gtk_window_set_title(GTK_WINDOW(self), _("Style Browser")); @@ -100,7 +106,16 @@ static void irreco_style_browser_dlg_init(IrrecoStyleBrowserDlg *self) gtk_dialog_add_buttons(GTK_DIALOG(self), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); - + + /*g_print("\n1\n"); + self->button_widget = irreco_button_browser_widget_new(self->irreco_data); + g_print("\n2\n");*/ + + + /*gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(self)->vbox), + GTK_WIDGET(self->button_widget));*/ + +#if 0 /* Create widgets. */ scrolled = irreco_scrolled_window_new_with_autoresize(400, 700, 200, 400); scrolled_name = irreco_scrolled_window_new_with_autoresize(10, 700, 200, 400); @@ -177,9 +192,10 @@ static void irreco_style_browser_dlg_init(IrrecoStyleBrowserDlg *self) g_signal_connect(G_OBJECT (select), "changed", G_CALLBACK (irreco_style_browser_dlg_row_selected_event), self); - +#endif /* Show dialog, hopefully on the left-top corner of the screen. */ gtk_widget_show_all(GTK_WIDGET(self)); + g_print("\n3\n"); gtk_window_move(GTK_WINDOW(self), 80, 60); IRRECO_RETURN } @@ -190,10 +206,13 @@ GtkWidget* irreco_style_browser_dlg_new(IrrecoData *irreco_data, { IrrecoStyleBrowserDlg *self; IRRECO_ENTER - + g_print("\nn1\n"); self = g_object_new(IRRECO_TYPE_STYLE_BROWSER_DLG, NULL); + g_print("\nn2\n"); irreco_dlg_set_parent(IRRECO_DLG(self), parent); + g_print("\nn3\n"); irreco_style_browser_dlg_set_irreco_data(self, irreco_data); + irreco_style_browser_dlg_set_button_widget(self); IRRECO_RETURN_PTR(self); } @@ -202,7 +221,7 @@ GtkWidget* irreco_style_browser_dlg_new(IrrecoData *irreco_data, /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Private Functions */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ - +#if 0 static void irreco_style_browser_dlg_add_style(IrrecoStyleBrowserDlg *self, IrrecoButtonStyle *style) { @@ -240,7 +259,7 @@ static void irreco_style_browser_dlg_add_style(IrrecoStyleBrowserDlg *self, irreco_button_layout_create_widgets(layout); IRRECO_RETURN } - +#endif /* TODO replace by irreco_style_browser_dlg_name_loading_start */ #if 0 static void irreco_style_browser_dlg_loading_start(IrrecoStyleBrowserDlg *self) @@ -273,6 +292,7 @@ static void irreco_style_browser_dlg_loading_cancel(IrrecoStyleBrowserDlg *self) if (self->loading != NULL) self->loading->self = NULL; IRRECO_RETURN } + #if 0 /* TODO orig */ static gboolean @@ -313,7 +333,7 @@ irreco_style_browser_dlg_loading_loop(IrrecoStyleBrowserDlgLoading *loading) } } #endif - +#if 0 /* TODO */ /* Start loading names to treeview */ /* Really done like this? Look example somewhere */ @@ -475,7 +495,7 @@ irreco_style_browser_dlg_loading_loop_pictures(IrrecoStyleBrowserDlgLoading *loa IRRECO_RETURN_BOOL(FALSE); } } - +#endif @@ -491,6 +511,23 @@ void irreco_style_browser_dlg_set_irreco_data(IrrecoStyleBrowserDlg *self, IRRECO_RETURN } +void irreco_style_browser_dlg_set_button_widget(IrrecoStyleBrowserDlg *self) +{ + IRRECO_ENTER + + self->button_widget = irreco_button_browser_widget_new(self->irreco_data); + + gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(self)->vbox), + GTK_WIDGET(self->button_widget)); + g_print("\n3n\n"); + /* Signal handlers. */ + /*g_signal_connect(G_OBJECT(self), "map-event", + G_CALLBACK(irreco_style_browser_dlg_map_event), NULL);*/ + gtk_widget_show_all(GTK_WIDGET(self)); + + IRRECO_RETURN +} + gboolean irreco_show_style_browser_dlg(IrrecoData *irreco_data, GtkWindow *parent, IrrecoButtonStyle **style) @@ -516,7 +553,8 @@ gboolean irreco_show_style_browser_dlg(IrrecoData *irreco_data, /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Events and Callbacks */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ - +/* TODO TODO TODO enable and add signal handler to this */ +#if 0 static void irreco_style_browser_dlg_button_click(IrrecoButton *irreco_button, IrrecoStyleBrowserDlg *self) { @@ -525,7 +563,7 @@ static void irreco_style_browser_dlg_button_click(IrrecoButton *irreco_button, gtk_dialog_response(GTK_DIALOG(self), 1); IRRECO_RETURN } - +#endif /* TODO remove */ /* orig */ /*static gboolean irreco_style_browser_dlg_map_event(IrrecoStyleBrowserDlg *self, @@ -539,6 +577,7 @@ static void irreco_style_browser_dlg_button_click(IrrecoButton *irreco_button, /* Dialog is shown so start loading theme names by calling ...name_loading_start */ +#if 0 static gboolean irreco_style_browser_dlg_map_event(IrrecoStyleBrowserDlg *self, GdkEvent *event, gpointer user_data) @@ -588,7 +627,7 @@ static void irreco_style_browser_dlg_row_selected_event(GtkTreeSelection *select IRRECO_RETURN } - +#endif /* diff --git a/irreco/trunk/src/core/irreco_style_browser_dlg.h b/irreco/trunk/src/core/irreco_style_browser_dlg.h index 2c3e077c..6f668047 100644 --- a/irreco/trunk/src/core/irreco_style_browser_dlg.h +++ b/irreco/trunk/src/core/irreco_style_browser_dlg.h @@ -72,6 +72,7 @@ typedef struct _IrrecoStyleBrowserDlgClass IrrecoStyleBrowserDlgClass; #include "irreco_data.h" #include "irreco_listbox.h" #include "irreco_listbox_text.h" +#include "irreco_button_browser_widget.h" @@ -83,7 +84,10 @@ struct _IrrecoStyleBrowserDlg{ IrrecoDlg parent; IrrecoData *irreco_data; - GtkWidget *vbox; /* ? */ + /*GtkWidget *vbox;*/ /* ? */ + IrrecoButtonStyle *style; + IrrecoButtonBrowserWidget *button_widget; +#if 0 GtkWidget *vbox2; /* button pics holder */ IrrecoButtonStyle *style; GHashTable *layout_array; @@ -91,10 +95,11 @@ struct _IrrecoStyleBrowserDlg{ IrrecoListbox *listbox; /* replaces treeview */ GtkWidget *scrollbar; /* used ? */ IrrecoStringTable *buttons_table; /* holds buttons of selected theme */ - +#endif IrrecoStyleBrowserDlgLoading *loading; gboolean once; + }; struct _IrrecoStyleBrowserDlgLoading { -- 2.11.4.GIT