diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2007-01-13 13:05:17 +0000 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2007-01-13 13:05:17 +0000 |
commit | f70403b0a5f74e13907262e668653eef29803754 (patch) | |
tree | 498345255df4283ba01b9f27a477005183cf11e5 | |
parent | b1d1223551baa57174020af62c58016deca90096 (diff) |
Started working on SyncManager (GUI only; does not work currently, needs backend).
-rw-r--r-- | hardinfo2/Makefile.in | 2 | ||||
-rw-r--r-- | hardinfo2/benchmark.c | 16 | ||||
-rw-r--r-- | hardinfo2/callbacks.c | 6 | ||||
-rw-r--r-- | hardinfo2/callbacks.h | 1 | ||||
-rwxr-xr-x | hardinfo2/configure | 37 | ||||
-rw-r--r-- | hardinfo2/hardinfo.c | 6 | ||||
-rw-r--r-- | hardinfo2/menu.c | 5 | ||||
-rw-r--r-- | hardinfo2/pixmaps/boot.png | bin | 783 -> 1339 bytes | |||
-rw-r--r-- | hardinfo2/pixmaps/keyboard.png | bin | 796 -> 741 bytes | |||
-rw-r--r-- | hardinfo2/pixmaps/printer.png | bin | 810 -> 957 bytes | |||
-rw-r--r-- | hardinfo2/pixmaps/status-curr.png | bin | 0 -> 828 bytes | |||
-rw-r--r-- | hardinfo2/pixmaps/status-done.png | bin | 0 -> 1019 bytes | |||
-rw-r--r-- | hardinfo2/pixmaps/syncmanager-small.png | bin | 0 -> 964 bytes | |||
-rw-r--r-- | hardinfo2/pixmaps/syncmanager.png | bin | 0 -> 3840 bytes | |||
-rw-r--r-- | hardinfo2/report.c | 3 | ||||
-rw-r--r-- | hardinfo2/stock.c | 1 | ||||
-rw-r--r-- | hardinfo2/stock.h | 1 | ||||
-rw-r--r-- | hardinfo2/syncmanager.c | 337 | ||||
-rw-r--r-- | hardinfo2/syncmanager.h | 25 | ||||
-rw-r--r-- | hardinfo2/uidefs.xml | 3 | ||||
-rw-r--r-- | hardinfo2/util.c | 16 |
21 files changed, 446 insertions, 13 deletions
diff --git a/hardinfo2/Makefile.in b/hardinfo2/Makefile.in index 12d48e28..3c122d4f 100644 --- a/hardinfo2/Makefile.in +++ b/hardinfo2/Makefile.in @@ -7,7 +7,7 @@ CFLAGS = -fPIC -pipe -Wall -g $(GTK_CFLAGS) $(GLADE_CFLAGS) -I. OBJECTS = hardinfo.o shell.o util.o iconcache.o loadgraph.o sha1.o md5.o \ menu.o stock.o callbacks.o expr.o report.o blowfish.o binreloc.o \ - vendor.o socket.o fbench.o + vendor.o socket.o fbench.o syncmanager.o MODULES = computer.so devices.so benchmark.so all: $(OBJECTS) $(MODULES) diff --git a/hardinfo2/benchmark.c b/hardinfo2/benchmark.c index 81d66534..afb31743 100644 --- a/hardinfo2/benchmark.c +++ b/hardinfo2/benchmark.c @@ -224,6 +224,22 @@ ModuleEntry *hi_module_get_entries(void) return entries; } +gchar *get_all_results(void) +{ + return ""; +} + +ShellModuleMethod* +hi_exported_methods(void) +{ + static ShellModuleMethod m[] = { + { "getAllResults", get_all_results }, + { NULL } + }; + + return m; +} + ModuleAbout * hi_module_get_about(void) { diff --git a/hardinfo2/callbacks.c b/hardinfo2/callbacks.c index bd69e07d..31fa9441 100644 --- a/hardinfo2/callbacks.c +++ b/hardinfo2/callbacks.c @@ -25,9 +25,15 @@ #include <shell.h> #include <report.h> +#include <syncmanager.h> #include <config.h> +void cb_sync_manager() +{ + sync_manager_show(); +} + void cb_save_graphic() { Shell *shell = shell_get_main_shell(); diff --git a/hardinfo2/callbacks.h b/hardinfo2/callbacks.h index 7b1170e4..f730381d 100644 --- a/hardinfo2/callbacks.h +++ b/hardinfo2/callbacks.h @@ -32,6 +32,7 @@ void cb_side_pane(); void cb_toolbar(); void cb_open_web_page(); void cb_open_online_docs(); +void cb_sync_manager(); void cb_report_bug(); #endif /* __CALLBACKS_H__ */ diff --git a/hardinfo2/configure b/hardinfo2/configure index 449ee2e8..a5ac23db 100755 --- a/hardinfo2/configure +++ b/hardinfo2/configure @@ -120,7 +120,7 @@ GTK2=-1 MIN_VERSION="2.6.0" echo -n "Checking for GTK version >= ${MIN_VERSION}... " for i in `which pkg-config`; do - pkg-config --errors-to-stdout gtk+-2.0 \ + $i --errors-to-stdout gtk+-2.0 \ --atleast-version=$MIN_VERSION > /dev/null case $? in 0) @@ -144,6 +144,35 @@ if [ $GTK2 -eq -1 ]; then exit fi +# --------------------------------------------------------------------------- + +SOUP=-1 +MIN_VERSION="2.2" +echo -n "Checking for libsoup version >= ${MIN_VERSION}... " +for i in `which pkg-config`; do + $i --errors-to-stdout libsoup-2.2 \ + --atleast-version=$MIN_VERSION > /dev/null + case $? in + 0) + SOUP_FLAGS=`pkg-config libsoup-2.2 --cflags` + SOUP_LIBS=`pkg-config libsoup-2.2 --libs` + echo "found `pkg-config libsoup-2.2 --modversion`" + SOUP=1 + break ;; + *) + echo "not found." ;; + esac +done + +# -------------------------------------------------------------------------- + +if [ $SOUP -eq -1 ]; then + echo -e "\nYou need the libsoup library, including the development stuff." + echo "If you're using Debian, running the command as root:" + echo -e "\n\taptitude install libsoup2.2-dev\n" + echo "Will do the trick." +fi + # -------------------------------------------------------------------------- echo -e "\nWriting config.h..." @@ -164,7 +193,7 @@ echo "#define PREFIX \"/usr/share/hardinfo/\"" >> config.h echo "#define LIBPREFIX \"/usr/lib/hardinfo/\"" >> config.h if [ "$RELEASE" == "1" ]; then - echo "#define DEBUG(...)" >> config.h + echo "#define DEBUG(...) (void)" >> config.h else echo '#define DEBUG(msg,...) fprintf(stderr, "*** %s:%d (%s) *** " msg "\n", \' >> config.h echo ' __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__)' >> config.h @@ -180,8 +209,8 @@ rm -f Makefile echo "GTK_LIBS = ${GTK_LIBS}" > Makefile echo "GTK_CFLAGS = ${GTK_FLAGS}" >> Makefile -echo "GLADE_LIBS = ${GLADE_LIBS}" >> Makefile -echo "GLADE_CFLAGS = ${GLADE_FLAGS}" >> Makefile +echo "SOUP_LIBS = ${SOUP_LIBS}" >> Makefile +echo "SOUP_CFLAGS = ${SOUP_CFLAGS}" >> Makefile echo "PACKAGE = `basename ${PWD}`" >> Makefile echo "ARCHOPTS = " >> Makefile diff --git a/hardinfo2/hardinfo.c b/hardinfo2/hardinfo.c index fa80dd3e..3c01529c 100644 --- a/hardinfo2/hardinfo.c +++ b/hardinfo2/hardinfo.c @@ -72,15 +72,15 @@ main(int argc, char **argv) /* list all module names */ if (params.list_modules) { g_print("Modules:\n" - "%-20s%-15s%-12s%-20s\n", "File Name", "Name", "Version", "Author"); + "%-20s%-15s%-12s\n", "File Name", "Name", "Version"); for (modules = modules_load_all(); modules; modules = modules->next) { ShellModule *module = (ShellModule *) modules->data; ModuleAbout *ma = module_get_about(module); gchar *name = g_path_get_basename(g_module_name(module->dll)); - g_print("%-20s%-15s%-12s%-20s\n", - name, module->name, ma->version, ma->author); + g_print("%-20s%-15s%-12s\n", + name, module->name, ma->version); g_free(name); } diff --git a/hardinfo2/menu.c b/hardinfo2/menu.c index 46b4568e..2b18034f 100644 --- a/hardinfo2/menu.c +++ b/hardinfo2/menu.c @@ -41,6 +41,11 @@ static GtkActionEntry entries[] = NULL, /* tooltip */ G_CALLBACK(cb_generate_report) }, + { "SyncManagerAction", HI_STOCK_SYNC_MENU, + "_Open SyncManager...", NULL, + NULL, + G_CALLBACK(cb_sync_manager) }, + { "CopyAction", GTK_STOCK_COPY, "_Copy to Clipboard", "<control>C", NULL, diff --git a/hardinfo2/pixmaps/boot.png b/hardinfo2/pixmaps/boot.png Binary files differindex 0c2a2d10..aef0e91a 100644 --- a/hardinfo2/pixmaps/boot.png +++ b/hardinfo2/pixmaps/boot.png diff --git a/hardinfo2/pixmaps/keyboard.png b/hardinfo2/pixmaps/keyboard.png Binary files differindex fb422a0d..4a63e535 100644 --- a/hardinfo2/pixmaps/keyboard.png +++ b/hardinfo2/pixmaps/keyboard.png diff --git a/hardinfo2/pixmaps/printer.png b/hardinfo2/pixmaps/printer.png Binary files differindex 65caccf3..3c3aa974 100644 --- a/hardinfo2/pixmaps/printer.png +++ b/hardinfo2/pixmaps/printer.png diff --git a/hardinfo2/pixmaps/status-curr.png b/hardinfo2/pixmaps/status-curr.png Binary files differnew file mode 100644 index 00000000..1ee5a29e --- /dev/null +++ b/hardinfo2/pixmaps/status-curr.png diff --git a/hardinfo2/pixmaps/status-done.png b/hardinfo2/pixmaps/status-done.png Binary files differnew file mode 100644 index 00000000..896eb720 --- /dev/null +++ b/hardinfo2/pixmaps/status-done.png diff --git a/hardinfo2/pixmaps/syncmanager-small.png b/hardinfo2/pixmaps/syncmanager-small.png Binary files differnew file mode 100644 index 00000000..58f19c68 --- /dev/null +++ b/hardinfo2/pixmaps/syncmanager-small.png diff --git a/hardinfo2/pixmaps/syncmanager.png b/hardinfo2/pixmaps/syncmanager.png Binary files differnew file mode 100644 index 00000000..9f019ac5 --- /dev/null +++ b/hardinfo2/pixmaps/syncmanager.png diff --git a/hardinfo2/report.c b/hardinfo2/report.c index ecd0af3a..485a7a73 100644 --- a/hardinfo2/report.c +++ b/hardinfo2/report.c @@ -386,8 +386,7 @@ report_get_filename(void) if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { gchar *ext = file_chooser_get_extension(dialog, file_types); filename = file_chooser_build_filename(dialog, ext); - } - + } gtk_widget_destroy (dialog); return filename; } diff --git a/hardinfo2/stock.c b/hardinfo2/stock.c index 98052186..6387273a 100644 --- a/hardinfo2/stock.c +++ b/hardinfo2/stock.c @@ -29,6 +29,7 @@ static struct { { "internet.png", HI_STOCK_INTERNET }, { "module.png", HI_STOCK_MODULE }, { "about-modules.png", HI_STOCK_ABOUT_MODULES }, + { "syncmanager-small.png", HI_STOCK_SYNC_MENU }, }; static GtkIconFactory *icon_factory; diff --git a/hardinfo2/stock.h b/hardinfo2/stock.h index 8f4e634b..236fdfb4 100644 --- a/hardinfo2/stock.h +++ b/hardinfo2/stock.h @@ -23,6 +23,7 @@ #define HI_STOCK_INTERNET "hi-stock-internet" #define HI_STOCK_MODULE "hi-stock-module" #define HI_STOCK_ABOUT_MODULES "hi-stock-about-modules" +#define HI_STOCK_SYNC_MENU "hi-stock-sync-menu" void stock_icons_init(void); void stock_icon_register(gchar *filename, gchar *stock_id); diff --git a/hardinfo2/syncmanager.c b/hardinfo2/syncmanager.c new file mode 100644 index 00000000..0767f926 --- /dev/null +++ b/hardinfo2/syncmanager.c @@ -0,0 +1,337 @@ +#include "syncmanager.h" +#include "iconcache.h" +#include "hardinfo.h" + +typedef struct _SyncDialog SyncDialog; +typedef struct _SyncNetArea SyncNetArea; +typedef struct _SyncNetAction SyncNetAction; + +struct _SyncNetArea { + GtkWidget *vbox; +}; + +struct _SyncNetAction { + gchar *name; + gboolean (*do_action)(SyncDialog *sd); +}; + +struct _SyncDialog { + GtkWidget *dialog; + GtkWidget *label; + + GtkWidget *button_sync; + GtkWidget *button_cancel; + GtkWidget *button_close; + + GtkWidget *scroll_box; + + SyncNetArea *sna; +}; + +static GSList *entries = NULL; + +#define LABEL_SYNC_DEFAULT "<big><b>Synchronize with Central Database</b></big>\n" \ + "The following information may be synchronized " \ + "with the HardInfo central database. <i>No information " \ + "that ultimately identify this computer will be " \ + "sent.</i>" +#define LABEL_SYNC_SYNCING "<big><b>Synchronizing</b></big>\n" \ + "This may take some time." + +static SyncDialog *sync_dialog_new(void); +static void sync_dialog_destroy(SyncDialog *sd); +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); +static void sync_dialog_netarea_hide(SyncDialog *sd); +static void sync_dialog_netarea_start_actions(SyncDialog *sd, SyncNetAction *sna, + gint n); + +void sync_manager_add_entry(SyncEntry *entry) +{ + entries = g_slist_prepend(entries, entry); +} + +void sync_manager_show(void) +{ + SyncDialog *sd = sync_dialog_new(); + + if (gtk_dialog_run(GTK_DIALOG(sd->dialog)) == GTK_RESPONSE_ACCEPT) { + sync_dialog_start_sync(sd); + } + + sync_dialog_destroy(sd); +} + +static gboolean _action_wait(SyncDialog *sd) +{ + nonblock_sleep(1000); + return TRUE; +} + +static gboolean _action_wait_fail(SyncDialog *sd) +{ + nonblock_sleep(2000); + return FALSE; +} + +static void sync_dialog_start_sync(SyncDialog *sd) +{ + SyncNetAction actions[] = { + { "Contacting HardInfo central database", _action_wait }, + { "Sending benchmark results (1/3)", _action_wait }, + { "Sending benchmark results (2/3)", _action_wait }, + { "Sending benchmark results (3/3)", _action_wait }, + { "Receiving benchmark results", _action_wait }, + { "This should fail!", _action_wait_fail }, + { "Sync finished", NULL }, + }; + + gtk_widget_hide(sd->button_sync); + gtk_widget_set_sensitive(sd->button_cancel, FALSE); + sync_dialog_netarea_show(sd); + + sync_dialog_netarea_start_actions(sd, actions, G_N_ELEMENTS(actions)); + + gtk_widget_hide(sd->button_cancel); + gtk_widget_show(sd->button_close); + + /* wait for the user to close the dialog */ + gtk_main(); +} + +static void sync_dialog_netarea_start_actions(SyncDialog *sd, SyncNetAction sna[], gint n) +{ + gint i; + GtkWidget **labels; + GtkWidget **icons; + GdkPixbuf *done_icon = icon_cache_get_pixbuf("status-done.png"); + GdkPixbuf *curr_icon = icon_cache_get_pixbuf("status-curr.png"); + + labels = g_new0(GtkWidget *, n); + icons = g_new0(GtkWidget *, n); + + for (i = 0; i < n; i++) { + GtkWidget *hbox; + + hbox = gtk_hbox_new(FALSE, 5); + + labels[i] = gtk_label_new(sna[i].name); + icons[i] = gtk_image_new(); + + gtk_widget_set_size_request(icons[i], + gdk_pixbuf_get_width(done_icon), + gdk_pixbuf_get_height(done_icon)); + + gtk_label_set_use_markup(GTK_LABEL(labels[i]), TRUE); + gtk_misc_set_alignment(GTK_MISC(labels[i]), 0.0, 0.5); + + gtk_box_pack_start(GTK_BOX(hbox), icons[i], FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), labels[i], TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(sd->sna->vbox), hbox, FALSE, FALSE, 3); + + gtk_widget_show_all(hbox); + } + + while (gtk_events_pending()) + gtk_main_iteration(); + + for (i = 0; i < n; i++) { + gchar *bold; + + bold = g_strdup_printf("<b>%s</b>", sna[i].name); + gtk_label_set_markup(GTK_LABEL(labels[i]), bold); + g_free(bold); + + gtk_image_set_from_pixbuf(GTK_IMAGE(icons[i]), curr_icon); + + if (sna[i].do_action && !sna[i].do_action(sd)) { + gtk_image_set_from_pixbuf(GTK_IMAGE(icons[i]), + icon_cache_get_pixbuf("dialog-error.png")); + g_warning("Failed while performing \"%s\". Please file a bug report " \ + "if this problem persists. (Use the Help\342\206\222Report" \ + " bug option.)", sna[i].name); + break; + } + + gtk_image_set_from_pixbuf(GTK_IMAGE(icons[i]), done_icon); + gtk_label_set_markup(GTK_LABEL(labels[i]), sna[i].name); + } + + g_free(labels); + g_free(icons); +} + +static SyncNetArea *sync_dialog_netarea_new(void) +{ + SyncNetArea *sna = g_new0(SyncNetArea, 1); + + sna->vbox = gtk_vbox_new(FALSE, 0); + + gtk_container_set_border_width(GTK_CONTAINER(sna->vbox), 10); + + gtk_widget_show_all(sna->vbox); + gtk_widget_hide(sna->vbox); + + return sna; +} + +static void sync_dialog_netarea_destroy(SyncNetArea *sna) +{ + g_return_if_fail(sna != NULL); + + gtk_widget_destroy(sna->vbox); + g_free(sna); +} + +static void sync_dialog_netarea_show(SyncDialog *sd) +{ + g_return_if_fail(sd && sd->sna); + + gtk_widget_hide(GTK_WIDGET(sd->scroll_box)); + gtk_widget_show(GTK_WIDGET(sd->sna->vbox)); + + gtk_label_set_markup(GTK_LABEL(sd->label), LABEL_SYNC_SYNCING); + gtk_window_set_default_size(GTK_WINDOW(sd->dialog), 0, 0); + gtk_window_reshow_with_initial_size(GTK_WINDOW(sd->dialog)); +} + +static void sync_dialog_netarea_hide(SyncDialog *sd) +{ + g_return_if_fail(sd && sd->sna); + + gtk_widget_show(GTK_WIDGET(sd->scroll_box)); + gtk_widget_hide(GTK_WIDGET(sd->sna->vbox)); + + gtk_label_set_markup(GTK_LABEL(sd->label), LABEL_SYNC_DEFAULT); + gtk_window_reshow_with_initial_size(GTK_WINDOW(sd->dialog)); +} + +static SyncDialog *sync_dialog_new(void) +{ + SyncDialog *sd; + GtkWidget *dialog; + GtkWidget *dialog1_vbox; + GtkWidget *scrolledwindow2; +// GtkWidget *treeview2; + GtkWidget *dialog1_action_area; + GtkWidget *button8; + GtkWidget *button7; + GtkWidget *button6; + GtkWidget *label; + GtkWidget *hbox; + +// GtkTreeViewColumn *column; +// GtkCellRenderer *cr_text, *cr_pbuf, *cr_toggle; + + sd = g_new0(SyncDialog, 1); + sd->sna = sync_dialog_netarea_new(); + + dialog = gtk_dialog_new(); + gtk_window_set_title(GTK_WINDOW(dialog), "SyncManager"); + gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); + gtk_window_set_default_size(GTK_WINDOW(dialog), 420, 260); +// gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent)); + gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT); + gtk_window_set_type_hint(GTK_WINDOW(dialog), + GDK_WINDOW_TYPE_HINT_DIALOG); + + dialog1_vbox = GTK_DIALOG(dialog)->vbox; + gtk_box_set_spacing(GTK_BOX(dialog1_vbox), 5); + gtk_container_set_border_width(GTK_CONTAINER(dialog1_vbox), 4); + gtk_widget_show(dialog1_vbox); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(dialog1_vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(LABEL_SYNC_DEFAULT); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + + gtk_box_pack_start(GTK_BOX(hbox), + icon_cache_get_image("syncmanager.png"), + FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); + gtk_widget_show_all(hbox); + + gtk_box_pack_start(GTK_BOX(dialog1_vbox), sd->sna->vbox, TRUE, TRUE, 0); + + scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL); + gtk_widget_show(scrolledwindow2); + gtk_box_pack_start(GTK_BOX(dialog1_vbox), scrolledwindow2, TRUE, TRUE, 0); + gtk_widget_set_size_request(scrolledwindow2, -1, 200); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow2), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW + (scrolledwindow2), GTK_SHADOW_IN); +/* + treeview2 = gtk_tree_view_new_with_model(model); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview2), FALSE); + gtk_widget_show(treeview2); + gtk_container_add(GTK_CONTAINER(scrolledwindow2), treeview2); + + column = gtk_tree_view_column_new(); + gtk_tree_view_append_column(GTK_TREE_VIEW(treeview2), column); + + cr_toggle = gtk_cell_renderer_toggle_new(); + gtk_tree_view_column_pack_start(column, cr_toggle, FALSE); + g_signal_connect(cr_toggle, "toggled", G_CALLBACK(report_dialog_sel_toggle), sd); + gtk_tree_view_column_add_attribute(column, cr_toggle, "active", + TREE_COL_SEL); + + cr_pbuf = gtk_cell_renderer_pixbuf_new(); + gtk_tree_view_column_pack_start(column, cr_pbuf, FALSE); + gtk_tree_view_column_add_attribute(column, cr_pbuf, "pixbuf", + TREE_COL_PBUF); + + cr_text = gtk_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(column, cr_text, TRUE); + gtk_tree_view_column_add_attribute(column, cr_text, "markup", + TREE_COL_NAME); + */ + + dialog1_action_area = GTK_DIALOG(dialog)->action_area; + gtk_widget_show(dialog1_action_area); + gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog1_action_area), + GTK_BUTTONBOX_END); + + button8 = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_widget_show(button8); + gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button8, + GTK_RESPONSE_CANCEL); + GTK_WIDGET_SET_FLAGS(button8, GTK_CAN_DEFAULT); + + button7 = gtk_button_new_with_mnemonic("_Synchronize"); + gtk_widget_show(button7); + gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button7, + GTK_RESPONSE_ACCEPT); + GTK_WIDGET_SET_FLAGS(button7, GTK_CAN_DEFAULT); + + button6 = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + g_signal_connect(G_OBJECT(button6), "clicked", (GCallback)gtk_main_quit, NULL); + gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button6, + GTK_RESPONSE_ACCEPT); + GTK_WIDGET_SET_FLAGS(button6, GTK_CAN_DEFAULT); + + sd->dialog = dialog; + sd->button_sync = button7; + sd->button_cancel = button8; + sd->button_close = button6; + sd->scroll_box = scrolledwindow2; + sd->label = label; + //gtk_tree_view_collapse_all(GTK_TREE_VIEW(treeview2)); + //set_all_active(sd, TRUE); + + return sd; +} + +static void sync_dialog_destroy(SyncDialog *sd) +{ + gtk_widget_destroy(sd->dialog); + sync_dialog_netarea_destroy(sd->sna); + g_free(sd); +} diff --git a/hardinfo2/syncmanager.h b/hardinfo2/syncmanager.h new file mode 100644 index 00000000..19025029 --- /dev/null +++ b/hardinfo2/syncmanager.h @@ -0,0 +1,25 @@ +#ifndef __SYNCMANAGER_H__ +#define __SYNCMANAGER_H__ + +#include <gtk/gtk.h> + +typedef struct _SyncEntry SyncEntry; + +typedef enum { + SYNC_RECEIVE, + SYNC_SEND, + SYNC_BOTH +} SyncDirection; + +struct _SyncEntry { + gchar *name; + gchar *save_to; + SyncDirection direction; + + gchar *(*get_data)(void); +}; + +void sync_manager_add_entry(SyncEntry *entry); +void sync_manager_show(void); + +#endif /* __SYNCMANAGER_H__ */ diff --git a/hardinfo2/uidefs.xml b/hardinfo2/uidefs.xml index f4fad0e3..f5cb1376 100644 --- a/hardinfo2/uidefs.xml +++ b/hardinfo2/uidefs.xml @@ -4,8 +4,9 @@ <menuitem name="Copy" action="CopyAction" /> <menuitem name="SaveGraph" action="SaveGraphAction" /> <separator/> + <menuitem name="SyncManager" action="SyncManagerAction" /> <menuitem name="Report" action="ReportAction" /> - <separator/> + <separator name="LastSep"/> <menuitem name="Quit" action="QuitAction" /> </menu> <menu name="ViewMenu" action="ViewMenuAction"> diff --git a/hardinfo2/util.c b/hardinfo2/util.c index 50a2e095..7267758b 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -335,6 +335,13 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) g_option_context_free(ctx); + if (*argc >= 2) { + g_print("Unrecognized arguments.\n" + "Try ``%s --help'' for more information.\n", + *(argv)[0]); + exit(1); + } + param->create_report = create_report; param->report_format = REPORT_FORMAT_TEXT; param->show_version = show_version; @@ -343,7 +350,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) param->autoload_deps = autoload_deps; if (report_format && g_str_equal(report_format, "html")) - param->report_format = REPORT_FORMAT_HTML; + param->report_format = REPORT_FORMAT_HTML; } gboolean ui_init(int *argc, char ***argv) @@ -770,11 +777,16 @@ void tree_view_save_image(gchar *filename) gboolean tv_enabled; + /* present the window */ + gtk_window_present(GTK_WINDOW(shell->window)); + /* if the treeview is disabled, we need to enable it so we get the correct colors when saving. we make it insensitive later on if it was this way before entering this function */ tv_enabled = GTK_WIDGET_IS_SENSITIVE(widget); gtk_widget_set_sensitive(widget, TRUE); + + gtk_widget_queue_draw(widget); /* unselect things in the information treeview */ gtk_range_set_value(GTK_RANGE @@ -879,7 +891,7 @@ void module_entry_scan_all_except(ModuleEntry *entries, gint except_entry) if (i == except_entry) continue; - shell_status_update(idle_free(g_strdup_printf("<b>Scanning:</b> %s...", entry.name))); + shell_status_update(idle_free(g_strdup_printf("Scanning: %s...", entry.name))); if ((scan_callback = entry.scan_callback)) { scan_callback(FALSE); |