1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
3 * irreco_theme_creator_backgrounds.c
4 * Copyright (C) 2008 <>
6 * irreco_theme_creator_backgrounds.c is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * irreco_theme_creator_backgrounds.c is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "irreco_theme_creator_backgrounds.h"
21 #include "irreco_theme_creator_dlg.h"
24 * @addtogroup IrrecoThemeCreatorBackgrounds
27 * User interface for IrrecoThemeCreatorDlgBackgrounds.
34 * Source file of @ref IrrecoThemeCreatorBackgrounds.
37 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
39 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
41 #define IRRECO_BACKGROUNDS_PREVIEW_WIDHT (IRRECO_SCREEN_WIDTH / 6)
42 #define IRRECO_BACKGROUNDS_PREVIEW_HEIGHT (IRRECO_SCREEN_HEIGHT / 6)
54 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
56 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
64 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
65 /* Construction & Destruction */
66 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
69 * @name Construction & Destruction
75 G_DEFINE_TYPE (IrrecoThemeCreatorBackgrounds
, irreco_theme_creator_backgrounds
,
76 IRRECO_TYPE_INTERNAL_WIDGET
)
80 irreco_theme_creator_backgrounds_finalize (GObject
*object
)
82 /* TODO: Add deinitalization code here */
85 irreco_theme_creator_backgrounds_parent_class
)->finalize (object
);
91 irreco_theme_creator_backgrounds_class_init
92 (IrrecoThemeCreatorBackgroundsClass
*klass
)
94 GObjectClass
*object_class
;
97 object_class
= G_OBJECT_CLASS (klass
);
98 object_class
->finalize
= irreco_theme_creator_backgrounds_finalize
;
103 irreco_theme_creator_backgrounds_init (IrrecoThemeCreatorBackgrounds
*self
)
105 /* TODO: Add initialization code here */
107 /*Backgrounds widgets*/
113 gtk_box_set_spacing(GTK_BOX(self
), 1);
117 self
->scroll_backgrounds
= gtk_scrolled_window_new(NULL
, NULL
);
118 self
->store_backgrounds
= gtk_list_store_new(2, GDK_TYPE_PIXBUF
,
120 self
->view_backgrounds
= gtk_tree_view_new();
122 gtk_box_pack_start_defaults(GTK_BOX(self
), self
->scroll_backgrounds
);
124 /*BACKGROUNDS COLUMNS*/
125 gtk_tree_view_set_model(GTK_TREE_VIEW(self
->view_backgrounds
),
126 GTK_TREE_MODEL(self
->store_backgrounds
));
127 g_object_unref(self
->store_backgrounds
);
129 /* Create pixbuf column. */
130 self
->renderer_backgrounds
= gtk_cell_renderer_pixbuf_new();
131 self
->column_backgrounds
= gtk_tree_view_column_new_with_attributes(
133 self
->renderer_backgrounds
,
134 "pixbuf", PIXBUF_COL
, NULL
);
135 gtk_tree_view_append_column(GTK_TREE_VIEW(self
->view_backgrounds
),
136 self
->column_backgrounds
);
138 /* Create text column. */
139 self
->renderer_backgrounds
= gtk_cell_renderer_text_new();
140 self
->column_backgrounds
= gtk_tree_view_column_new_with_attributes(
142 self
->renderer_backgrounds
,
143 "text", TEXT_COL
, NULL
);
144 gtk_tree_view_append_column(GTK_TREE_VIEW(self
->view_backgrounds
),
145 self
->column_backgrounds
);
146 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(self
->view_backgrounds
),
150 /* Scroll_backgrounds*/
152 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self
->scroll_backgrounds
),
153 GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
154 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(
155 self
->scroll_backgrounds
),
156 self
->view_backgrounds
);
160 GtkWidget
* irreco_theme_creator_backgrounds_new(GtkWindow
*parent
,
161 IrrecoData
*irreco_data
,
162 IrrecoTheme
* irreco_theme
)
164 IrrecoThemeCreatorBackgrounds
*self
;
167 self
= g_object_new(IRRECO_TYPE_THEME_CREATOR_BACKGROUNDS
,
168 "irreco-data", irreco_data
,
171 irreco_theme_creator_backgrounds_set_parent_window(self
, parent
);
172 IRRECO_RETURN_PTR(GTK_WIDGET(self
));
179 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
180 /* Private Functions */
181 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
184 * @name Private Functions
189 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
190 /* Public Functions */
191 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
194 * @name Public Functions
199 * Set parent window for popup dialogs.
202 irreco_theme_creator_backgrounds_set_parent_window(
203 IrrecoThemeCreatorBackgrounds
*self
,
207 self
->parent_window
= parent
;