Back to index

lshw  02.16
callbacks.c
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #  include <config.h>
00003 #endif
00004 
00005 #include <gtk/gtk.h>
00006 
00007 #include "callbacks.h"
00008 #include "support.h"
00009 #include "version.h"
00010 #include "engine.h"
00011 #include <string.h>
00012 
00013 extern GtkWidget *about;
00014 extern GtkWidget *mainwindow;
00015 
00016 static char *id = "@(#) $Id: callbacks.c 2433 2012-01-10 22:01:30Z lyonel $";
00017 
00018 G_MODULE_EXPORT
00019 void
00020 refresh_display                        (GtkMenuItem     *menuitem,
00021 gpointer         user_data)
00022 {
00023   refresh(mainwindow);
00024 }
00025 
00026 
00027 G_MODULE_EXPORT
00028 void
00029 on_about1_activate                     (GtkMenuItem     *menuitem,
00030 gpointer         user_data)
00031 {
00032   if(GTK_IS_WIDGET(about))
00033   {
00034     gtk_widget_show(about);
00035   }
00036 }
00037 
00038 
00039 G_MODULE_EXPORT
00040 void
00041 on_aboutclose_activate          (GtkButton       *button,
00042 gpointer         user_data)
00043 {
00044   if(GTK_IS_WIDGET(about))
00045   {
00046     gtk_widget_hide(about);
00047   }
00048 }
00049 
00050 
00051 G_MODULE_EXPORT
00052 void
00053 on_version_realize                     (GtkWidget       *widget,
00054 gpointer         user_data)
00055 {
00056   const char *latest = checkupdates();
00057 
00058   gtk_label_set_text(GTK_LABEL(widget), getpackageversion());
00059 
00060   if(latest)
00061   {
00062     if(strcmp(latest, getpackageversion()) != 0)
00063     {
00064       static GtkWidget *dialog = NULL;
00065 
00066       if(!GTK_IS_WIDGET(dialog))
00067       {
00068         dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(mainwindow),
00069                                   GTK_DIALOG_DESTROY_WITH_PARENT,
00070                                   GTK_MESSAGE_INFO,
00071                                   GTK_BUTTONS_CLOSE,
00072                                   "The latest version is <tt>%s</tt>.\n\nYou can visit <span foreground=\"blue\"><u>http://www.ezix.org/</u></span> for more information.",
00073                                   latest);
00074 
00075         gtk_window_set_title(GTK_WINDOW(dialog), "Update available");
00076         /* Destroy the dialog when the user responds to it (e.g. clicks a button) */
00077         g_signal_connect_swapped (dialog, "response",
00078                            G_CALLBACK (gtk_widget_destroy),
00079                            dialog);
00080       }
00081 
00082       gtk_widget_show(dialog);
00083     }
00084   }
00085 }
00086 
00087 
00088 G_MODULE_EXPORT
00089 void
00090 on_treeview1_row_activated             (GtkTreeView     *treeview,
00091 GtkTreePath     *path,
00092 GtkTreeViewColumn *column,
00093 gpointer         user_data)
00094 {
00095   browse(1, treeview);
00096 }
00097 
00098 
00099 G_MODULE_EXPORT
00100 void
00101 on_treeview2_row_activated             (GtkTreeView     *treeview,
00102 GtkTreePath     *path,
00103 GtkTreeViewColumn *column,
00104 gpointer         user_data)
00105 {
00106   browse(2, treeview);
00107 }
00108 
00109 
00110 G_MODULE_EXPORT
00111 void
00112 on_treeview3_row_activated             (GtkTreeView     *treeview,
00113 GtkTreePath     *path,
00114 GtkTreeViewColumn *column,
00115 gpointer         user_data)
00116 {
00117   browse(3, treeview);
00118 }
00119 
00120 
00121 G_MODULE_EXPORT
00122 void
00123 on_treeview1_cursor_changed            (GtkTreeView     *treeview,
00124 gpointer         user_data)
00125 {
00126   change_selection(1, treeview);
00127 }
00128 
00129 
00130 G_MODULE_EXPORT
00131 void
00132 on_treeview2_cursor_changed            (GtkTreeView     *treeview,
00133 gpointer         user_data)
00134 {
00135   change_selection(2, treeview);
00136 }
00137 
00138 
00139 G_MODULE_EXPORT
00140 void
00141 on_treeview3_cursor_changed            (GtkTreeView     *treeview,
00142 gpointer         user_data)
00143 {
00144   change_selection(3, treeview);
00145 
00146   (void) &id;                                     // avoid warning "id defined but not used"
00147 }
00148 
00149 
00150 G_MODULE_EXPORT
00151 void
00152 go_up                                  (GtkToolButton   *toolbutton,
00153 gpointer         user_data)
00154 {
00155   go_back(mainwindow);
00156 }
00157 
00158 
00159 G_MODULE_EXPORT
00160 void
00161 on_lshw_map                            (GtkWidget       *widget,
00162 gpointer         user_data)
00163 {
00164   refresh(mainwindow);
00165 }
00166 
00167 G_MODULE_EXPORT
00168 void
00169 on_save_activate                       (GtkMenuItem     *menuitem,
00170                                         gpointer         user_data)
00171 {
00172   save_as(mainwindow);
00173 }
00174 
00175 
00176 G_MODULE_EXPORT
00177 void
00178 on_savebutton_clicked                  (GtkToolButton   *toolbutton,
00179                                         gpointer         user_data)
00180 {
00181   on_save_activate(NULL, NULL);
00182 }
00183