diff --git a/src/gtk/common/config.c b/src/gtk/common/config.c index f4d1bf7..768060a 100644 --- a/src/gtk/common/config.c +++ b/src/gtk/common/config.c @@ -113,6 +113,38 @@ gchar * get_last_error_msg(void) return FALSE; } + + void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data) + { + HKEY hKey = 0; + + if(RegOpenKeyEx(parent,name,0,KEY_READ,&hKey) == ERROR_SUCCESS) + { + #define MAX_KEY_LENGTH 255 + #define MAX_VALUE_NAME 16383 + + TCHAR pName[MAX_KEY_LENGTH]; + DWORD cName = MAX_KEY_LENGTH; + int ix = 0; + + while(RegEnumValue(hKey,ix++,pName,&cName,NULL,NULL,NULL,NULL) == ERROR_SUCCESS) + { + BYTE data[4097]; + unsigned long datatype; + unsigned long datalen = 4096; + + if(RegQueryValueExA(hKey,pName,NULL,&datatype,data,&datalen) == ERROR_SUCCESS) + { + data[datalen+1] = 0; + cbk(pName,data,user_data); + } + cName = MAX_KEY_LENGTH; + } + RegCloseKey(hKey); + } + } + + #else static gchar * search_for_ini(void) { diff --git a/src/gtk/print.c b/src/gtk/print.c index 25590e5..7f3700d 100644 --- a/src/gtk/print.c +++ b/src/gtk/print.c @@ -380,6 +380,13 @@ static gchar * enum_to_string(GType type, guint enum_value) g_object_unref(combo); } +#ifdef WIN32 + void update_settings(const gchar *key, const gchar *val, gpointer *settings) + { + gtk_print_settings_set(GTK_PRINT_SETTINGS(settings), key, val); + } +#endif // WIN32 + static GtkPrintOperation * begin_print_operation(GtkAction *action, GtkWidget *widget, PRINT_INFO **info) { GtkPrintOperation * print = gtk_print_operation_new(); @@ -418,13 +425,23 @@ static gchar * enum_to_string(GType type, guint enum_value) { #ifdef WIN32 - #warning Implementar + HKEY registry; + + if(get_registry_handle("print",®istry,KEY_READ)) + { + registry_foreach(registry,"settings",update_settings,(gpointer) settings); + + + + + #warning Work in progress + RegCloseKey(registry); + } #else GKeyFile * conf = get_application_keyfile(); GError * err = NULL; - if(!gtk_print_settings_load_key_file(settings,conf,"print_settings",&err)) { g_warning("Error getting print settings: %s",err->message); diff --git a/ui/00default.xml b/ui/00default.xml index 54d692d..902f55b 100644 --- a/ui/00default.xml +++ b/ui/00default.xml @@ -45,7 +45,7 @@ - + -- libgit2 0.21.2