Commit a4dea2fc82fd065e281f1caa0a5a4584147553c9

Authored by perry.werneck@gmail.com
1 parent 9f5905ab

Implementando dialogo de cor

Showing 2 changed files with 39 additions and 5 deletions   Show diff stats
src/gtk/colors.c
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 32
33 /*--[ Implement ]------------------------------------------------------------------------------------*/ 33 /*--[ Implement ]------------------------------------------------------------------------------------*/
34 34
  35 +/*
35 void load_color_schemes(GtkWidget *widget, gchar *active) 36 void load_color_schemes(GtkWidget *widget, gchar *active)
36 { 37 {
37 gchar *filename = build_data_filename("colors.conf",NULL); 38 gchar *filename = build_data_filename("colors.conf",NULL);
@@ -136,6 +137,25 @@ @@ -136,6 +137,25 @@
136 137
137 g_free(filename); 138 g_free(filename);
138 } 139 }
  140 +*/
  141 +
  142 +/**
  143 + * Create a color scheme dropdown button
  144 + *
  145 + * @param clr Pointer to current color table
  146 + *
  147 + */
  148 + GtkWidget * color_scheme_new(GdkColor *clr)
  149 + {
  150 +#if GTK_CHECK_VERSION(3,0,0)
  151 + GtkWidget *widget = gtk_combo_box_text_new();
  152 +#else
  153 + GtkWidget *widget = gtk_combo_box_new();
  154 +#endif // GTK(3,0,0)
  155 +
  156 +
  157 + return widget;
  158 + }
139 159
140 static void color_changed(GtkColorSelection *colorselection, GtkWidget *widget) 160 static void color_changed(GtkColorSelection *colorselection, GtkWidget *widget)
141 { 161 {
@@ -311,10 +331,22 @@ @@ -311,10 +331,22 @@
311 331
312 } 332 }
313 333
314 - // Run dialog  
315 gtk_widget_show_all(panned); 334 gtk_widget_show_all(panned);
316 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(panned),TRUE,TRUE,2); 335 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(panned),TRUE,TRUE,2);
317 336
  337 + // Color scheme combo
  338 + {
  339 + GtkWidget * box = gtk_hbox_new(FALSE,2);
  340 + GtkWidget * button = color_scheme_new(NULL);
  341 +
  342 + gtk_box_pack_start(GTK_BOX(box),gtk_label_new(_("Color scheme:")),FALSE,FALSE,2);
  343 + gtk_box_pack_start(GTK_BOX(box),button,TRUE,TRUE,2);
  344 + gtk_widget_show_all(box);
  345 + gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,TRUE,TRUE,2);
  346 + }
  347 +
  348 + // Run dialog
  349 +
318 if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) 350 if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
319 { 351 {
320 // Accepted, save in configuration file 352 // Accepted, save in configuration file
src/gtk/print.c
@@ -179,6 +179,7 @@ @@ -179,6 +179,7 @@
179 trace("Font set to \"%s\" with size %d",info->font,info->fontsize); 179 trace("Font set to \"%s\" with size %d",info->font,info->fontsize);
180 } 180 }
181 181
  182 +/*
182 static void color_scheme_changed(GtkComboBox *widget,PRINT_INFO *info) 183 static void color_scheme_changed(GtkComboBox *widget,PRINT_INFO *info)
183 { 184 {
184 gchar *new_colors = NULL; 185 gchar *new_colors = NULL;
@@ -211,6 +212,7 @@ @@ -211,6 +212,7 @@
211 info->colorname = new_colors; 212 info->colorname = new_colors;
212 213
213 } 214 }
  215 +*/
214 216
215 static void toggle_show_selection(GtkToggleButton *togglebutton,PRINT_INFO *info) 217 static void toggle_show_selection(GtkToggleButton *togglebutton,PRINT_INFO *info)
216 { 218 {
@@ -284,10 +286,10 @@ @@ -284,10 +286,10 @@
284 widget = gtk_combo_box_new(); 286 widget = gtk_combo_box_new();
285 #endif // GTK(3,0,0) 287 #endif // GTK(3,0,0)
286 288
287 - info->colorname = get_string_from_config("print","colors",def_colors);  
288 - load_color_schemes(widget,info->colorname);  
289 -  
290 - g_signal_connect(G_OBJECT(widget),"changed",G_CALLBACK(color_scheme_changed),info); 289 + gtk_widget_set_sensitive(widget,FALSE);
  290 +// info->colorname = get_string_from_config("print","colors",def_colors);
  291 +// load_color_schemes(widget,info->colorname);
  292 +// g_signal_connect(G_OBJECT(widget),"changed",G_CALLBACK(color_scheme_changed),info);
291 293
292 gtk_table_attach(GTK_TABLE(container),widget,1,2,1,2,GTK_EXPAND|GTK_FILL,GTK_FILL,5,0); 294 gtk_table_attach(GTK_TABLE(container),widget,1,2,1,2,GTK_EXPAND|GTK_FILL,GTK_FILL,5,0);
293 295