From a5a465f6633112226ad64566d7146c2e44488dc5 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Wed, 14 Feb 2007 17:40:39 +0000 Subject: Add proxy support for SyncManager. Remove uidefs.xml; add uidefs.h. --- hardinfo2/menu.c | 4 +++- hardinfo2/syncmanager.c | 27 ++++++++++++++++++++++++--- hardinfo2/uidefs.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ hardinfo2/util.c | 2 +- 4 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 hardinfo2/uidefs.h (limited to 'hardinfo2') diff --git a/hardinfo2/menu.c b/hardinfo2/menu.c index 6bae39ff..3b45cef0 100644 --- a/hardinfo2/menu.c +++ b/hardinfo2/menu.c @@ -28,6 +28,8 @@ #include #include +#include "uidefs.h" + static GtkActionEntry entries[] = { { "InformationMenuAction", NULL, "_Information" }, /* name, stock id, label */ @@ -136,7 +138,7 @@ void menu_init(Shell *shell) /* Read in the UI from our XML file */ error = NULL; - gtk_ui_manager_add_ui_from_file(menu_manager, idle_free(g_build_filename(params.path_data, "uidefs.xml", NULL)), &error); + gtk_ui_manager_add_ui_from_string(menu_manager, uidefs_str, -1, &error); if (error) { g_error("Building menus failed: %s", error->message); diff --git a/hardinfo2/syncmanager.c b/hardinfo2/syncmanager.c index 74b70c78..cf091b3a 100644 --- a/hardinfo2/syncmanager.c +++ b/hardinfo2/syncmanager.c @@ -79,7 +79,9 @@ static void sync_dialog_start_sync(SyncDialog *sd); static SyncNetArea *sync_dialog_netarea_new(void); static void sync_dialog_netarea_destroy(SyncNetArea *sna); static void sync_dialog_netarea_show(SyncDialog *sd); +#if 0 static void sync_dialog_netarea_hide(SyncDialog *sd); +#endif static void sync_dialog_netarea_start_actions(SyncDialog *sd, SyncNetAction *sna, gint n); @@ -283,8 +285,6 @@ static void _action_call_function_got_response(SoupMessage *msg, gpointer user_d g_file_set_contents(filename, string, -1, NULL); g_free(filename); - } else { - DEBUG("not saving :("); } g_free(string); @@ -363,13 +363,32 @@ static SyncNetAction *sync_manager_get_selected_actions(gint *n) return actions; } +static SoupUri *sync_manager_get_proxy(void) +{ + const gchar *conf; + + if (!(conf = g_getenv("HTTP_PROXY"))) { + if (!(conf = g_getenv("http_proxy"))) { + return NULL; + } + } + + return soup_uri_new(conf); +} + static void sync_dialog_start_sync(SyncDialog *sd) { gint nactions; SyncNetAction *actions; if (!session) { - session = soup_session_async_new_with_options(SOUP_SESSION_TIMEOUT, 10, NULL); + SoupUri *proxy = sync_manager_get_proxy(); + + session = soup_session_async_new_with_options(SOUP_SESSION_TIMEOUT, 10, + SOUP_SESSION_PROXY_URI, proxy, NULL); + + if (proxy) + g_object_unref(proxy); } loop = g_main_loop_new(NULL, TRUE); @@ -509,6 +528,7 @@ static void sync_dialog_netarea_show(SyncDialog *sd) gtk_window_reshow_with_initial_size(GTK_WINDOW(sd->dialog)); } +#if 0 static void sync_dialog_netarea_hide(SyncDialog *sd) { g_return_if_fail(sd && sd->sna); @@ -519,6 +539,7 @@ static void sync_dialog_netarea_hide(SyncDialog *sd) gtk_label_set_markup(GTK_LABEL(sd->label), LABEL_SYNC_DEFAULT); gtk_window_reshow_with_initial_size(GTK_WINDOW(sd->dialog)); } +#endif static void populate_store(GtkListStore *store) { diff --git a/hardinfo2/uidefs.h b/hardinfo2/uidefs.h new file mode 100644 index 00000000..f384504b --- /dev/null +++ b/hardinfo2/uidefs.h @@ -0,0 +1,48 @@ +#ifndef __UIDEFS_H__ +#define __UIDEFS_H__ + +char *uidefs_str = "" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +"" \ +""; + +#endif /* __UIDEFS_H__ */ diff --git a/hardinfo2/util.c b/hardinfo2/util.c index 52839308..288dda6c 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -213,7 +213,7 @@ gboolean binreloc_init(gboolean try_hardcoded) /* Try to see if the uidefs.xml file isn't missing. This isn't the definitive test, but it should do okay for most situations. */ - tmp = g_build_filename(params.path_data, "uidefs.xml", NULL); + tmp = g_build_filename(params.path_data, "benchmark.data", NULL); if (!g_file_test(tmp, G_FILE_TEST_EXISTS)) { DEBUG("runtime data not found"); -- cgit v1.2.3