wok-6.x view gcolor2/stuff/gcolor2.patch @ rev 22026

updated thermald (1.3.rc1 -> 1.9)
author Hans-G?nter Theisgen
date Sun Oct 20 15:47:58 2019 +0100 (2019-10-20)
parents
children
line source
1 --- a/src/main.c
2 +++ b/src/main.c
3 @@ -17,7 +17,7 @@
5 void set_user_file ()
6 {
7 - user_filename = g_strdup_printf ("%s/.rgb.txt", getenv ("HOME"));
8 + user_filename = g_strconcat (g_get_user_data_dir(), "/.rgb.txt", NULL);
9 }
11 gchar* get_user_file ()
12 @@ -27,15 +27,9 @@
14 gboolean set_system_file ()
15 {
16 - /* try a couple locations to find rgb.txt */
17 + /* try location to find rgb.txt */
18 if (g_file_test (SYSTEM_FILE_1, G_FILE_TEST_EXISTS))
19 sys_filename = SYSTEM_FILE_1;
20 - else if (g_file_test (SYSTEM_FILE_2, G_FILE_TEST_EXISTS))
21 - sys_filename = SYSTEM_FILE_2;
22 - else if (g_file_test (SYSTEM_FILE_3, G_FILE_TEST_EXISTS))
23 - sys_filename = SYSTEM_FILE_3;
24 - else if (g_file_test (SYSTEM_FILE_4, G_FILE_TEST_EXISTS))
25 - sys_filename = SYSTEM_FILE_4;
26 else
27 return FALSE;
28 return TRUE;
29 @@ -151,7 +145,6 @@
30 gtk_set_locale ();
31 gtk_init (&argc, &argv);
33 - add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps/" PACKAGE);
35 gcolor2 = create_gcolor2 ();
36 gtk_widget_show (gcolor2);
37 @@ -164,7 +157,7 @@
38 gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (liststore));
40 column = gtk_tree_view_column_new ();
41 - gtk_tree_view_column_set_title (column, "Color");
42 + gtk_tree_view_column_set_title (column, _("Color"));
44 renderer = gtk_cell_renderer_pixbuf_new ();
45 gtk_tree_view_column_pack_start (column, renderer, FALSE);
46 @@ -179,7 +172,7 @@
49 renderer = gtk_cell_renderer_text_new ();
50 - column = gtk_tree_view_column_new_with_attributes ("Name", renderer,
51 + column = gtk_tree_view_column_new_with_attributes (_("Name"), renderer,
52 "text", COLOR_NAME, NULL);
53 gtk_tree_view_column_set_sort_column_id (column, COLOR_NAME);
54 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
56 --- a/src/callbacks.h
57 +++ b/src/callbacks.h
58 @@ -8,10 +8,7 @@
59 #define FILE_WRITE "write"
61 /* possible locations of the rgb file */
62 -#define SYSTEM_FILE_1 "/usr/X11R6/lib/X11/rgb.txt"
63 -#define SYSTEM_FILE_2 "/usr/lib/X11/rgb.txt"
64 -#define SYSTEM_FILE_3 "/etc/X11/rgb.txt"
65 -#define SYSTEM_FILE_4 "/usr/openwin/lib/X11/rgb.txt"
66 +#define SYSTEM_FILE_1 "/usr/share/X11/rgb.txt"
68 /* about dialog text */
69 #define ABOUT_CREDITS_TEXT "Developer:\n" \
71 --- a/src/interface.c
72 +++ b/src/interface.c
73 @@ -48,8 +48,6 @@
74 GtkWidget *about_button;
75 GtkWidget *alignment1;
76 GtkWidget *hbox2;
77 - GtkWidget *image3;
78 - GtkWidget *label5;
79 GtkWidget *quit_button;
80 GtkTooltips *tooltips;
82 @@ -59,12 +57,7 @@
83 gtk_container_set_border_width (GTK_CONTAINER (gcolor2), 1);
84 gtk_window_set_title (GTK_WINDOW (gcolor2), _("gcolor2"));
85 gtk_window_set_resizable (GTK_WINDOW (gcolor2), FALSE);
86 - gcolor2_icon_pixbuf = create_pixbuf ("icon.png");
87 - if (gcolor2_icon_pixbuf)
88 - {
89 - gtk_window_set_icon (GTK_WINDOW (gcolor2), gcolor2_icon_pixbuf);
90 - gdk_pixbuf_unref (gcolor2_icon_pixbuf);
91 - }
92 + gtk_window_set_icon_name (GTK_WINDOW (gcolor2), "gcolor2");
94 vbox1 = gtk_vbox_new (FALSE, 3);
95 gtk_widget_show (vbox1);
96 @@ -75,6 +68,7 @@
97 gtk_widget_show (colorselection);
98 gtk_box_pack_start (GTK_BOX (vbox1), colorselection, FALSE, TRUE, 0);
99 gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (colorselection), TRUE);
100 + gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (colorselection), TRUE);
102 expander = gtk_expander_new (NULL);
103 gtk_widget_show (expander);
104 @@ -136,12 +130,6 @@
105 gtk_widget_show (hbuttonbox3);
106 gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox3, FALSE, TRUE, 0);
108 - about_button = gtk_button_new ();
109 - gtk_widget_show (about_button);
110 - gtk_container_add (GTK_CONTAINER (hbuttonbox3), about_button);
111 - GTK_WIDGET_SET_FLAGS (about_button, GTK_CAN_DEFAULT);
112 - gtk_tooltips_set_tip (tooltips, about_button, _("About gcolor2"), NULL);
113 -
114 alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
115 gtk_widget_show (alignment1);
116 gtk_container_add (GTK_CONTAINER (about_button), alignment1);
117 @@ -150,14 +138,11 @@
118 gtk_widget_show (hbox2);
119 gtk_container_add (GTK_CONTAINER (alignment1), hbox2);
121 - image3 = create_pixmap (gcolor2, "about_icon.png");
122 - gtk_widget_show (image3);
123 - gtk_box_pack_start (GTK_BOX (hbox2), image3, FALSE, FALSE, 0);
124 + about_button = gtk_button_new_from_stock ("gtk-about");
125 + gtk_widget_show (about_button);
126 + gtk_tooltips_set_tip (tooltips, about_button, _("About gcolor2"), NULL);
127 + gtk_container_add (GTK_CONTAINER (hbuttonbox3), about_button);
129 - label5 = gtk_label_new_with_mnemonic (_("_About"));
130 - gtk_widget_show (label5);
131 - gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0);
132 -
133 quit_button = gtk_button_new_from_stock ("gtk-quit");
134 gtk_widget_show (quit_button);
135 gtk_container_add (GTK_CONTAINER (hbuttonbox3), quit_button);
136 @@ -208,8 +193,6 @@
137 GLADE_HOOKUP_OBJECT (gcolor2, about_button, "about_button");
138 GLADE_HOOKUP_OBJECT (gcolor2, alignment1, "alignment1");
139 GLADE_HOOKUP_OBJECT (gcolor2, hbox2, "hbox2");
140 - GLADE_HOOKUP_OBJECT (gcolor2, image3, "image3");
141 - GLADE_HOOKUP_OBJECT (gcolor2, label5, "label5");
142 GLADE_HOOKUP_OBJECT (gcolor2, quit_button, "quit_button");
143 GLADE_HOOKUP_OBJECT_NO_REF (gcolor2, tooltips, "tooltips");
145 @@ -238,12 +221,7 @@
146 gtk_window_set_modal (GTK_WINDOW (save_dialog), TRUE);
147 gtk_window_set_resizable (GTK_WINDOW (save_dialog), FALSE);
148 gtk_window_set_destroy_with_parent (GTK_WINDOW (save_dialog), TRUE);
149 - save_dialog_icon_pixbuf = create_pixbuf ("icon.png");
150 - if (save_dialog_icon_pixbuf)
151 - {
152 - gtk_window_set_icon (GTK_WINDOW (save_dialog), save_dialog_icon_pixbuf);
153 - gdk_pixbuf_unref (save_dialog_icon_pixbuf);
154 - }
155 + gtk_window_set_icon_name (GTK_WINDOW (save_dialog), "gcolor2");
156 gtk_window_set_type_hint (GTK_WINDOW (save_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
158 dialog_vbox1 = GTK_DIALOG (save_dialog)->vbox;
159 @@ -366,17 +344,13 @@
160 gtk_window_set_title (GTK_WINDOW (about_dialog), _("About gcolor2"));
161 gtk_window_set_resizable (GTK_WINDOW (about_dialog), FALSE);
162 gtk_window_set_destroy_with_parent (GTK_WINDOW (about_dialog), TRUE);
163 - about_dialog_icon_pixbuf = create_pixbuf ("icon.png");
164 - if (about_dialog_icon_pixbuf)
165 - {
166 - gtk_window_set_icon (GTK_WINDOW (about_dialog), about_dialog_icon_pixbuf);
167 - gdk_pixbuf_unref (about_dialog_icon_pixbuf);
168 - }
169 + gtk_window_set_icon_name (GTK_WINDOW (about_dialog), "gcolor2");
171 dialog_vbox3 = GTK_DIALOG (about_dialog)->vbox;
172 gtk_widget_show (dialog_vbox3);
174 - about_image = create_pixmap (about_dialog, "icon.png");
175 + //about_image = create_pixmap (about_dialog, "icon.png");
176 + about_image = gtk_image_new_from_icon_name ("gcolor2", GTK_ICON_SIZE_DIALOG);
177 gtk_widget_show (about_image);
178 gtk_box_pack_start (GTK_BOX (dialog_vbox3), about_image, FALSE, FALSE, 0);
180 @@ -483,12 +457,7 @@
181 gtk_window_set_modal (GTK_WINDOW (delete_dialog), TRUE);
182 gtk_window_set_resizable (GTK_WINDOW (delete_dialog), FALSE);
183 gtk_window_set_destroy_with_parent (GTK_WINDOW (delete_dialog), TRUE);
184 - delete_dialog_icon_pixbuf = create_pixbuf ("icon.png");
185 - if (delete_dialog_icon_pixbuf)
186 - {
187 - gtk_window_set_icon (GTK_WINDOW (delete_dialog), delete_dialog_icon_pixbuf);
188 - gdk_pixbuf_unref (delete_dialog_icon_pixbuf);
189 - }
190 + gtk_window_set_icon_name (GTK_WINDOW (delete_dialog), "gcolor2");
191 gtk_window_set_type_hint (GTK_WINDOW (delete_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
193 vbox3 = GTK_DIALOG (delete_dialog)->vbox;
195 --- a/src/support.c
196 +++ b/src/support.c
197 @@ -42,90 +42,6 @@
198 return found_widget;
199 }
201 -static GList *pixmaps_directories = NULL;
202 -
203 -/* Use this function to set the directory containing installed pixmaps. */
204 -void
205 -add_pixmap_directory (const gchar *directory)
206 -{
207 - pixmaps_directories = g_list_prepend (pixmaps_directories,
208 - g_strdup (directory));
209 -}
210 -
211 -/* This is an internally used function to find pixmap files. */
212 -static gchar*
213 -find_pixmap_file (const gchar *filename)
214 -{
215 - GList *elem;
216 -
217 - /* We step through each of the pixmaps directory to find it. */
218 - elem = pixmaps_directories;
219 - while (elem)
220 - {
221 - gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
222 - G_DIR_SEPARATOR_S, filename);
223 - if (g_file_test (pathname, G_FILE_TEST_EXISTS))
224 - return pathname;
225 - g_free (pathname);
226 - elem = elem->next;
227 - }
228 - return NULL;
229 -}
230 -
231 -/* This is an internally used function to create pixmaps. */
232 -GtkWidget*
233 -create_pixmap (GtkWidget *widget,
234 - const gchar *filename)
235 -{
236 - gchar *pathname = NULL;
237 - GtkWidget *pixmap;
238 -
239 - if (!filename || !filename[0])
240 - return gtk_image_new ();
241 -
242 - pathname = find_pixmap_file (filename);
243 -
244 - if (!pathname)
245 - {
246 - g_warning (_("Couldn't find pixmap file: %s"), filename);
247 - return gtk_image_new ();
248 - }
249 -
250 - pixmap = gtk_image_new_from_file (pathname);
251 - g_free (pathname);
252 - return pixmap;
253 -}
254 -
255 -/* This is an internally used function to create pixmaps. */
256 -GdkPixbuf*
257 -create_pixbuf (const gchar *filename)
258 -{
259 - gchar *pathname = NULL;
260 - GdkPixbuf *pixbuf;
261 - GError *error = NULL;
262 -
263 - if (!filename || !filename[0])
264 - return NULL;
265 -
266 - pathname = find_pixmap_file (filename);
267 -
268 - if (!pathname)
269 - {
270 - g_warning (_("Couldn't find pixmap file: %s"), filename);
271 - return NULL;
272 - }
273 -
274 - pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
275 - if (!pixbuf)
276 - {
277 - fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
278 - pathname, error->message);
279 - g_error_free (error);
280 - }
281 - g_free (pathname);
282 - return pixbuf;
283 -}
284 -
285 /* This is used to set ATK action descriptions. */
286 void
287 glade_set_atk_action_description (AtkAction *action,