wok-next annotate gcolor2/stuff/gcolor2.patch @ rev 18099

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