Commit ec4f3d3f8590557d91b806ae518c092736a619b3
1 parent
307e7706
Exists in
master
and in
5 other branches
Incluindo carga dos settings de impressao em windows
Showing
3 changed files
with
52 additions
and
3 deletions
Show diff stats
src/gtk/common/config.c
@@ -113,6 +113,38 @@ gchar * get_last_error_msg(void) | @@ -113,6 +113,38 @@ gchar * get_last_error_msg(void) | ||
113 | 113 | ||
114 | return FALSE; | 114 | return FALSE; |
115 | } | 115 | } |
116 | + | ||
117 | + void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data) | ||
118 | + { | ||
119 | + HKEY hKey = 0; | ||
120 | + | ||
121 | + if(RegOpenKeyEx(parent,name,0,KEY_READ,&hKey) == ERROR_SUCCESS) | ||
122 | + { | ||
123 | + #define MAX_KEY_LENGTH 255 | ||
124 | + #define MAX_VALUE_NAME 16383 | ||
125 | + | ||
126 | + TCHAR pName[MAX_KEY_LENGTH]; | ||
127 | + DWORD cName = MAX_KEY_LENGTH; | ||
128 | + int ix = 0; | ||
129 | + | ||
130 | + while(RegEnumValue(hKey,ix++,pName,&cName,NULL,NULL,NULL,NULL) == ERROR_SUCCESS) | ||
131 | + { | ||
132 | + BYTE data[4097]; | ||
133 | + unsigned long datatype; | ||
134 | + unsigned long datalen = 4096; | ||
135 | + | ||
136 | + if(RegQueryValueExA(hKey,pName,NULL,&datatype,data,&datalen) == ERROR_SUCCESS) | ||
137 | + { | ||
138 | + data[datalen+1] = 0; | ||
139 | + cbk(pName,data,user_data); | ||
140 | + } | ||
141 | + cName = MAX_KEY_LENGTH; | ||
142 | + } | ||
143 | + RegCloseKey(hKey); | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | + | ||
116 | #else | 148 | #else |
117 | static gchar * search_for_ini(void) | 149 | static gchar * search_for_ini(void) |
118 | { | 150 | { |
src/gtk/print.c
@@ -380,6 +380,13 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -380,6 +380,13 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
380 | g_object_unref(combo); | 380 | g_object_unref(combo); |
381 | } | 381 | } |
382 | 382 | ||
383 | +#ifdef WIN32 | ||
384 | + void update_settings(const gchar *key, const gchar *val, gpointer *settings) | ||
385 | + { | ||
386 | + gtk_print_settings_set(GTK_PRINT_SETTINGS(settings), key, val); | ||
387 | + } | ||
388 | +#endif // WIN32 | ||
389 | + | ||
383 | static GtkPrintOperation * begin_print_operation(GtkAction *action, GtkWidget *widget, PRINT_INFO **info) | 390 | static GtkPrintOperation * begin_print_operation(GtkAction *action, GtkWidget *widget, PRINT_INFO **info) |
384 | { | 391 | { |
385 | GtkPrintOperation * print = gtk_print_operation_new(); | 392 | GtkPrintOperation * print = gtk_print_operation_new(); |
@@ -418,13 +425,23 @@ static gchar * enum_to_string(GType type, guint enum_value) | @@ -418,13 +425,23 @@ static gchar * enum_to_string(GType type, guint enum_value) | ||
418 | { | 425 | { |
419 | #ifdef WIN32 | 426 | #ifdef WIN32 |
420 | 427 | ||
421 | - #warning Implementar | 428 | + HKEY registry; |
429 | + | ||
430 | + if(get_registry_handle("print",®istry,KEY_READ)) | ||
431 | + { | ||
432 | + registry_foreach(registry,"settings",update_settings,(gpointer) settings); | ||
433 | + | ||
434 | + | ||
435 | + | ||
436 | + | ||
437 | + #warning Work in progress | ||
438 | + RegCloseKey(registry); | ||
439 | + } | ||
422 | 440 | ||
423 | #else | 441 | #else |
424 | GKeyFile * conf = get_application_keyfile(); | 442 | GKeyFile * conf = get_application_keyfile(); |
425 | GError * err = NULL; | 443 | GError * err = NULL; |
426 | 444 | ||
427 | - | ||
428 | if(!gtk_print_settings_load_key_file(settings,conf,"print_settings",&err)) | 445 | if(!gtk_print_settings_load_key_file(settings,conf,"print_settings",&err)) |
429 | { | 446 | { |
430 | g_warning("Error getting print settings: %s",err->message); | 447 | g_warning("Error getting print settings: %s",err->message); |
ui/00default.xml
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | <menuitem action='save' src='copy' group='clipboard' label='Save copy' /> | 45 | <menuitem action='save' src='copy' group='clipboard' label='Save copy' /> |
46 | 46 | ||
47 | <separator/> | 47 | <separator/> |
48 | - <menuitem action='print' src='all' group='online' key='Print' icon='print' label='Print' /> | 48 | + <menuitem action='print' src='all' key='Print' icon='print' label='Print' /> |
49 | <menuitem action='print' src='selected' group='selection' label='Print selected' /> | 49 | <menuitem action='print' src='selected' group='selection' label='Print selected' /> |
50 | <menuitem action='print' src='copy' group='clipboard' label='Print copy' /> | 50 | <menuitem action='print' src='copy' group='clipboard' label='Print copy' /> |
51 | <separator/> | 51 | <separator/> |