wok-next diff gcolor2/stuff/gcolor2.patch @ rev 19669
syslinux: kbd 2.0.3 support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Mar 17 19:37:21 2017 +0100 (2017-03-17) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gcolor2/stuff/gcolor2.patch Fri Mar 17 19:37:21 2017 +0100 1.3 @@ -0,0 +1,287 @@ 1.4 +--- a/src/main.c 1.5 ++++ b/src/main.c 1.6 +@@ -17,7 +17,7 @@ 1.7 + 1.8 + void set_user_file () 1.9 + { 1.10 +- user_filename = g_strdup_printf ("%s/.rgb.txt", getenv ("HOME")); 1.11 ++ user_filename = g_strconcat (g_get_user_data_dir(), "/.rgb.txt", NULL); 1.12 + } 1.13 + 1.14 + gchar* get_user_file () 1.15 +@@ -27,15 +27,9 @@ 1.16 + 1.17 + gboolean set_system_file () 1.18 + { 1.19 +- /* try a couple locations to find rgb.txt */ 1.20 ++ /* try location to find rgb.txt */ 1.21 + if (g_file_test (SYSTEM_FILE_1, G_FILE_TEST_EXISTS)) 1.22 + sys_filename = SYSTEM_FILE_1; 1.23 +- else if (g_file_test (SYSTEM_FILE_2, G_FILE_TEST_EXISTS)) 1.24 +- sys_filename = SYSTEM_FILE_2; 1.25 +- else if (g_file_test (SYSTEM_FILE_3, G_FILE_TEST_EXISTS)) 1.26 +- sys_filename = SYSTEM_FILE_3; 1.27 +- else if (g_file_test (SYSTEM_FILE_4, G_FILE_TEST_EXISTS)) 1.28 +- sys_filename = SYSTEM_FILE_4; 1.29 + else 1.30 + return FALSE; 1.31 + return TRUE; 1.32 +@@ -151,7 +145,6 @@ 1.33 + gtk_set_locale (); 1.34 + gtk_init (&argc, &argv); 1.35 + 1.36 +- add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps/" PACKAGE); 1.37 + 1.38 + gcolor2 = create_gcolor2 (); 1.39 + gtk_widget_show (gcolor2); 1.40 +@@ -164,7 +157,7 @@ 1.41 + gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (liststore)); 1.42 + 1.43 + column = gtk_tree_view_column_new (); 1.44 +- gtk_tree_view_column_set_title (column, "Color"); 1.45 ++ gtk_tree_view_column_set_title (column, _("Color")); 1.46 + 1.47 + renderer = gtk_cell_renderer_pixbuf_new (); 1.48 + gtk_tree_view_column_pack_start (column, renderer, FALSE); 1.49 +@@ -179,7 +172,7 @@ 1.50 + 1.51 + 1.52 + renderer = gtk_cell_renderer_text_new (); 1.53 +- column = gtk_tree_view_column_new_with_attributes ("Name", renderer, 1.54 ++ column = gtk_tree_view_column_new_with_attributes (_("Name"), renderer, 1.55 + "text", COLOR_NAME, NULL); 1.56 + gtk_tree_view_column_set_sort_column_id (column, COLOR_NAME); 1.57 + gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); 1.58 + 1.59 +--- a/src/callbacks.h 1.60 ++++ b/src/callbacks.h 1.61 +@@ -8,10 +8,7 @@ 1.62 + #define FILE_WRITE "write" 1.63 + 1.64 + /* possible locations of the rgb file */ 1.65 +-#define SYSTEM_FILE_1 "/usr/X11R6/lib/X11/rgb.txt" 1.66 +-#define SYSTEM_FILE_2 "/usr/lib/X11/rgb.txt" 1.67 +-#define SYSTEM_FILE_3 "/etc/X11/rgb.txt" 1.68 +-#define SYSTEM_FILE_4 "/usr/openwin/lib/X11/rgb.txt" 1.69 ++#define SYSTEM_FILE_1 "/usr/share/X11/rgb.txt" 1.70 + 1.71 + /* about dialog text */ 1.72 + #define ABOUT_CREDITS_TEXT "Developer:\n" \ 1.73 + 1.74 +--- a/src/interface.c 1.75 ++++ b/src/interface.c 1.76 +@@ -48,8 +48,6 @@ 1.77 + GtkWidget *about_button; 1.78 + GtkWidget *alignment1; 1.79 + GtkWidget *hbox2; 1.80 +- GtkWidget *image3; 1.81 +- GtkWidget *label5; 1.82 + GtkWidget *quit_button; 1.83 + GtkTooltips *tooltips; 1.84 + 1.85 +@@ -59,12 +57,7 @@ 1.86 + gtk_container_set_border_width (GTK_CONTAINER (gcolor2), 1); 1.87 + gtk_window_set_title (GTK_WINDOW (gcolor2), _("gcolor2")); 1.88 + gtk_window_set_resizable (GTK_WINDOW (gcolor2), FALSE); 1.89 +- gcolor2_icon_pixbuf = create_pixbuf ("icon.png"); 1.90 +- if (gcolor2_icon_pixbuf) 1.91 +- { 1.92 +- gtk_window_set_icon (GTK_WINDOW (gcolor2), gcolor2_icon_pixbuf); 1.93 +- gdk_pixbuf_unref (gcolor2_icon_pixbuf); 1.94 +- } 1.95 ++ gtk_window_set_icon_name (GTK_WINDOW (gcolor2), "gcolor2"); 1.96 + 1.97 + vbox1 = gtk_vbox_new (FALSE, 3); 1.98 + gtk_widget_show (vbox1); 1.99 +@@ -75,6 +68,7 @@ 1.100 + gtk_widget_show (colorselection); 1.101 + gtk_box_pack_start (GTK_BOX (vbox1), colorselection, FALSE, TRUE, 0); 1.102 + gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (colorselection), TRUE); 1.103 ++ gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (colorselection), TRUE); 1.104 + 1.105 + expander = gtk_expander_new (NULL); 1.106 + gtk_widget_show (expander); 1.107 +@@ -136,12 +130,6 @@ 1.108 + gtk_widget_show (hbuttonbox3); 1.109 + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox3, FALSE, TRUE, 0); 1.110 + 1.111 +- about_button = gtk_button_new (); 1.112 +- gtk_widget_show (about_button); 1.113 +- gtk_container_add (GTK_CONTAINER (hbuttonbox3), about_button); 1.114 +- GTK_WIDGET_SET_FLAGS (about_button, GTK_CAN_DEFAULT); 1.115 +- gtk_tooltips_set_tip (tooltips, about_button, _("About gcolor2"), NULL); 1.116 +- 1.117 + alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0); 1.118 + gtk_widget_show (alignment1); 1.119 + gtk_container_add (GTK_CONTAINER (about_button), alignment1); 1.120 +@@ -150,14 +138,11 @@ 1.121 + gtk_widget_show (hbox2); 1.122 + gtk_container_add (GTK_CONTAINER (alignment1), hbox2); 1.123 + 1.124 +- image3 = create_pixmap (gcolor2, "about_icon.png"); 1.125 +- gtk_widget_show (image3); 1.126 +- gtk_box_pack_start (GTK_BOX (hbox2), image3, FALSE, FALSE, 0); 1.127 ++ about_button = gtk_button_new_from_stock ("gtk-about"); 1.128 ++ gtk_widget_show (about_button); 1.129 ++ gtk_tooltips_set_tip (tooltips, about_button, _("About gcolor2"), NULL); 1.130 ++ gtk_container_add (GTK_CONTAINER (hbuttonbox3), about_button); 1.131 + 1.132 +- label5 = gtk_label_new_with_mnemonic (_("_About")); 1.133 +- gtk_widget_show (label5); 1.134 +- gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0); 1.135 +- 1.136 + quit_button = gtk_button_new_from_stock ("gtk-quit"); 1.137 + gtk_widget_show (quit_button); 1.138 + gtk_container_add (GTK_CONTAINER (hbuttonbox3), quit_button); 1.139 +@@ -208,8 +193,6 @@ 1.140 + GLADE_HOOKUP_OBJECT (gcolor2, about_button, "about_button"); 1.141 + GLADE_HOOKUP_OBJECT (gcolor2, alignment1, "alignment1"); 1.142 + GLADE_HOOKUP_OBJECT (gcolor2, hbox2, "hbox2"); 1.143 +- GLADE_HOOKUP_OBJECT (gcolor2, image3, "image3"); 1.144 +- GLADE_HOOKUP_OBJECT (gcolor2, label5, "label5"); 1.145 + GLADE_HOOKUP_OBJECT (gcolor2, quit_button, "quit_button"); 1.146 + GLADE_HOOKUP_OBJECT_NO_REF (gcolor2, tooltips, "tooltips"); 1.147 + 1.148 +@@ -238,12 +221,7 @@ 1.149 + gtk_window_set_modal (GTK_WINDOW (save_dialog), TRUE); 1.150 + gtk_window_set_resizable (GTK_WINDOW (save_dialog), FALSE); 1.151 + gtk_window_set_destroy_with_parent (GTK_WINDOW (save_dialog), TRUE); 1.152 +- save_dialog_icon_pixbuf = create_pixbuf ("icon.png"); 1.153 +- if (save_dialog_icon_pixbuf) 1.154 +- { 1.155 +- gtk_window_set_icon (GTK_WINDOW (save_dialog), save_dialog_icon_pixbuf); 1.156 +- gdk_pixbuf_unref (save_dialog_icon_pixbuf); 1.157 +- } 1.158 ++ gtk_window_set_icon_name (GTK_WINDOW (save_dialog), "gcolor2"); 1.159 + gtk_window_set_type_hint (GTK_WINDOW (save_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); 1.160 + 1.161 + dialog_vbox1 = GTK_DIALOG (save_dialog)->vbox; 1.162 +@@ -366,17 +344,13 @@ 1.163 + gtk_window_set_title (GTK_WINDOW (about_dialog), _("About gcolor2")); 1.164 + gtk_window_set_resizable (GTK_WINDOW (about_dialog), FALSE); 1.165 + gtk_window_set_destroy_with_parent (GTK_WINDOW (about_dialog), TRUE); 1.166 +- about_dialog_icon_pixbuf = create_pixbuf ("icon.png"); 1.167 +- if (about_dialog_icon_pixbuf) 1.168 +- { 1.169 +- gtk_window_set_icon (GTK_WINDOW (about_dialog), about_dialog_icon_pixbuf); 1.170 +- gdk_pixbuf_unref (about_dialog_icon_pixbuf); 1.171 +- } 1.172 ++ gtk_window_set_icon_name (GTK_WINDOW (about_dialog), "gcolor2"); 1.173 + 1.174 + dialog_vbox3 = GTK_DIALOG (about_dialog)->vbox; 1.175 + gtk_widget_show (dialog_vbox3); 1.176 + 1.177 +- about_image = create_pixmap (about_dialog, "icon.png"); 1.178 ++ //about_image = create_pixmap (about_dialog, "icon.png"); 1.179 ++ about_image = gtk_image_new_from_icon_name ("gcolor2", GTK_ICON_SIZE_DIALOG); 1.180 + gtk_widget_show (about_image); 1.181 + gtk_box_pack_start (GTK_BOX (dialog_vbox3), about_image, FALSE, FALSE, 0); 1.182 + 1.183 +@@ -483,12 +457,7 @@ 1.184 + gtk_window_set_modal (GTK_WINDOW (delete_dialog), TRUE); 1.185 + gtk_window_set_resizable (GTK_WINDOW (delete_dialog), FALSE); 1.186 + gtk_window_set_destroy_with_parent (GTK_WINDOW (delete_dialog), TRUE); 1.187 +- delete_dialog_icon_pixbuf = create_pixbuf ("icon.png"); 1.188 +- if (delete_dialog_icon_pixbuf) 1.189 +- { 1.190 +- gtk_window_set_icon (GTK_WINDOW (delete_dialog), delete_dialog_icon_pixbuf); 1.191 +- gdk_pixbuf_unref (delete_dialog_icon_pixbuf); 1.192 +- } 1.193 ++ gtk_window_set_icon_name (GTK_WINDOW (delete_dialog), "gcolor2"); 1.194 + gtk_window_set_type_hint (GTK_WINDOW (delete_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); 1.195 + 1.196 + vbox3 = GTK_DIALOG (delete_dialog)->vbox; 1.197 + 1.198 +--- a/src/support.c 1.199 ++++ b/src/support.c 1.200 +@@ -42,90 +42,6 @@ 1.201 + return found_widget; 1.202 + } 1.203 + 1.204 +-static GList *pixmaps_directories = NULL; 1.205 +- 1.206 +-/* Use this function to set the directory containing installed pixmaps. */ 1.207 +-void 1.208 +-add_pixmap_directory (const gchar *directory) 1.209 +-{ 1.210 +- pixmaps_directories = g_list_prepend (pixmaps_directories, 1.211 +- g_strdup (directory)); 1.212 +-} 1.213 +- 1.214 +-/* This is an internally used function to find pixmap files. */ 1.215 +-static gchar* 1.216 +-find_pixmap_file (const gchar *filename) 1.217 +-{ 1.218 +- GList *elem; 1.219 +- 1.220 +- /* We step through each of the pixmaps directory to find it. */ 1.221 +- elem = pixmaps_directories; 1.222 +- while (elem) 1.223 +- { 1.224 +- gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, 1.225 +- G_DIR_SEPARATOR_S, filename); 1.226 +- if (g_file_test (pathname, G_FILE_TEST_EXISTS)) 1.227 +- return pathname; 1.228 +- g_free (pathname); 1.229 +- elem = elem->next; 1.230 +- } 1.231 +- return NULL; 1.232 +-} 1.233 +- 1.234 +-/* This is an internally used function to create pixmaps. */ 1.235 +-GtkWidget* 1.236 +-create_pixmap (GtkWidget *widget, 1.237 +- const gchar *filename) 1.238 +-{ 1.239 +- gchar *pathname = NULL; 1.240 +- GtkWidget *pixmap; 1.241 +- 1.242 +- if (!filename || !filename[0]) 1.243 +- return gtk_image_new (); 1.244 +- 1.245 +- pathname = find_pixmap_file (filename); 1.246 +- 1.247 +- if (!pathname) 1.248 +- { 1.249 +- g_warning (_("Couldn't find pixmap file: %s"), filename); 1.250 +- return gtk_image_new (); 1.251 +- } 1.252 +- 1.253 +- pixmap = gtk_image_new_from_file (pathname); 1.254 +- g_free (pathname); 1.255 +- return pixmap; 1.256 +-} 1.257 +- 1.258 +-/* This is an internally used function to create pixmaps. */ 1.259 +-GdkPixbuf* 1.260 +-create_pixbuf (const gchar *filename) 1.261 +-{ 1.262 +- gchar *pathname = NULL; 1.263 +- GdkPixbuf *pixbuf; 1.264 +- GError *error = NULL; 1.265 +- 1.266 +- if (!filename || !filename[0]) 1.267 +- return NULL; 1.268 +- 1.269 +- pathname = find_pixmap_file (filename); 1.270 +- 1.271 +- if (!pathname) 1.272 +- { 1.273 +- g_warning (_("Couldn't find pixmap file: %s"), filename); 1.274 +- return NULL; 1.275 +- } 1.276 +- 1.277 +- pixbuf = gdk_pixbuf_new_from_file (pathname, &error); 1.278 +- if (!pixbuf) 1.279 +- { 1.280 +- fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", 1.281 +- pathname, error->message); 1.282 +- g_error_free (error); 1.283 +- } 1.284 +- g_free (pathname); 1.285 +- return pixbuf; 1.286 +-} 1.287 +- 1.288 + /* This is used to set ATK action descriptions. */ 1.289 + void 1.290 + glade_set_atk_action_description (AtkAction *action,