diff options
-rw-r--r-- | hardinfo2/callbacks.c | 11 | ||||
-rw-r--r-- | hardinfo2/callbacks.h | 2 | ||||
-rw-r--r-- | hardinfo2/hardinfo.h | 1 | ||||
-rw-r--r-- | hardinfo2/menu.c | 10 | ||||
-rw-r--r-- | hardinfo2/pixmaps/internet.png | bin | 0 -> 864 bytes | |||
-rw-r--r-- | hardinfo2/shell.c | 5 | ||||
-rw-r--r-- | hardinfo2/stock.c | 3 | ||||
-rw-r--r-- | hardinfo2/stock.h | 1 | ||||
-rw-r--r-- | hardinfo2/uidefs.xml | 3 | ||||
-rw-r--r-- | hardinfo2/util.c | 22 |
10 files changed, 56 insertions, 2 deletions
diff --git a/hardinfo2/callbacks.c b/hardinfo2/callbacks.c index 957f9cc0..14a133a2 100644 --- a/hardinfo2/callbacks.c +++ b/hardinfo2/callbacks.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include <gtk/gtk.h> +#include <hardinfo.h> #include <callbacks.h> #include <iconcache.h> @@ -27,6 +28,16 @@ #include <config.h> +void cb_open_web_page() +{ + open_url("http://hardinfo.berlios.de"); +} + +void cb_report_bug() +{ + open_url("http://hardinfo.berlios.de/web/BugReports"); +} + void cb_refresh() { shell_do_reload(); diff --git a/hardinfo2/callbacks.h b/hardinfo2/callbacks.h index d08c975c..af553a9a 100644 --- a/hardinfo2/callbacks.h +++ b/hardinfo2/callbacks.h @@ -26,5 +26,7 @@ void cb_refresh(); void cb_copy_to_clipboard(); void cb_side_pane(); void cb_toolbar(); +void cb_open_web_page(); +void cb_report_bug(); #endif /* __CALLBACKS_H__ */ diff --git a/hardinfo2/hardinfo.h b/hardinfo2/hardinfo.h index 285a422c..d0da307b 100644 --- a/hardinfo2/hardinfo.h +++ b/hardinfo2/hardinfo.h @@ -54,6 +54,7 @@ gpointer file_types_get_data_by_name(FileTypes *file_types, gchar *name); /* Misc utility functions */ inline gchar *size_human_readable(gfloat size); void nonblock_sleep(guint msec); +void open_url(gchar *url); /* BinReloc stuff */ gboolean binreloc_init(gboolean try_hardcoded); diff --git a/hardinfo2/menu.c b/hardinfo2/menu.c index e663f918..1632c260 100644 --- a/hardinfo2/menu.c +++ b/hardinfo2/menu.c @@ -50,6 +50,16 @@ static GtkActionEntry entries[] = NULL, G_CALLBACK(cb_refresh) }, + { "HomePageAction", HI_STOCK_INTERNET, + "_Open HardInfo Web Site\342\200\246", NULL, + NULL, + G_CALLBACK(cb_open_web_page) }, + + { "ReportBugAction", HI_STOCK_INTERNET, + "_Report bug\342\200\246", NULL, + NULL, + G_CALLBACK(cb_report_bug) }, + { "AboutAction", GTK_STOCK_ABOUT, "_About\342\200\246", NULL, "Displays program version information", diff --git a/hardinfo2/pixmaps/internet.png b/hardinfo2/pixmaps/internet.png Binary files differnew file mode 100644 index 00000000..a5889683 --- /dev/null +++ b/hardinfo2/pixmaps/internet.png diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 5e602cfa..cf5d6d74 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -382,7 +382,6 @@ shell_tree_modules_load(ShellTree * shelltree) shelltree->modules = g_slist_append(shelltree->modules, module); } else { g_free(module->name); - g_free(module->icon); g_free(module); } @@ -391,6 +390,10 @@ shell_tree_modules_load(ShellTree * shelltree) g_strfreev(cat); g_key_file_free(keyfile); + + if (g_slist_length(shelltree->modules) == 0) { + g_error("No module could be loaded. Check permissions on %s and try again.", path_lib); + } } static void view_menu_select_entry(gpointer data, gpointer data2) diff --git a/hardinfo2/stock.c b/hardinfo2/stock.c index 34aea2e9..3f7b5688 100644 --- a/hardinfo2/stock.c +++ b/hardinfo2/stock.c @@ -24,7 +24,8 @@ static struct { gchar *filename; gchar *stock_id; } stock_icons[] = { - { "report.png", HI_STOCK_REPORT} + { "report.png", HI_STOCK_REPORT }, + { "internet.png", HI_STOCK_INTERNET }, }; static GtkIconFactory *icon_factory; diff --git a/hardinfo2/stock.h b/hardinfo2/stock.h index b40d48e1..f65383ae 100644 --- a/hardinfo2/stock.h +++ b/hardinfo2/stock.h @@ -20,6 +20,7 @@ #define __STOCK_H__ #define HI_STOCK_REPORT "hi-stock-report" +#define HI_STOCK_INTERNET "hi-stock-internet" void stock_icons_init(void); void stock_icon_register(gchar *filename, gchar *stock_id); diff --git a/hardinfo2/uidefs.xml b/hardinfo2/uidefs.xml index 77a67de2..ba742061 100644 --- a/hardinfo2/uidefs.xml +++ b/hardinfo2/uidefs.xml @@ -16,6 +16,9 @@ <separator name="LastSep"/> </menu> <menu name="HelpMenu" action="HelpMenuAction"> + <menuitem name="WebPage" action="HomePageAction"/> + <menuitem name="ReportBug" action="ReportBugAction"/> + <separator/> <menuitem name="About" action="AboutAction"/> </menu> </menubar> diff --git a/hardinfo2/util.c b/hardinfo2/util.c index 3e0dc5b3..5c1412dc 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -269,3 +269,25 @@ ui_init(int *argc, char ***argv) log_handler, NULL); return gtk_init_check(argc, argv); } + +void +open_url(gchar *url) +{ + const gchar *browsers[] = { "xdg-open", "gnome-open", "kfmclient openURL", "sensible-browser", + "firefox", "epiphany", "galeon", "mozilla", "opera", "konqueror", + "links -g", NULL}; + gint i; + + for (i = 0; browsers[i]; i++) { + gchar *cmdline = g_strdup_printf("%s '%s'", browsers[i], url); + + if (g_spawn_command_line_async(cmdline, NULL)) { + g_free(cmdline); + return; + } + + g_free(cmdline); + } + + g_warning("Couldn't find a Web browser to open URL %s.", url); +} |