interface.c (usbview-2.1) | : | interface.c (usbview-2.2) | ||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
#include <gtk/gtk.h> | #include <gtk/gtk.h> | |||
#include "usbtree.h" | #include "usbtree.h" | |||
#include "hicolor/64x64/apps/usbview_icon.xpm" | #include "hicolor/64x64/apps/usbview_icon.xpm" | |||
GtkWidget *treeUSB; | GtkWidget *treeUSB; | |||
GtkTreeStore *treeStore; | GtkTreeStore *treeStore; | |||
GtkTextBuffer *textDescriptionBuffer; | GtkTextBuffer *textDescriptionBuffer; | |||
GtkWidget *textDescriptionView; | GtkWidget *textDescriptionView; | |||
GtkWidget *windowMain; | GtkWidget *windowMain; | |||
static GtkTreeViewColumn *treeColumn; | ||||
int timer; | int timer; | |||
static gboolean | ||||
query_tooltip_cb(GtkWidget *widget, gint x, gint y, | ||||
gboolean keyboard_tip, GtkTooltip *tooltip, void *unused) | ||||
{ | ||||
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeUSB)); | ||||
GtkTreePath *path = NULL; | ||||
GtkTreeIter iter; | ||||
gint cellx = 0, celly = 0; | ||||
gchar *color; | ||||
gboolean return_val = FALSE; | ||||
if (!model) | ||||
return FALSE; | ||||
/* This -30 is a kludge. It seems that if you don't do this, gtk_tree_vie | ||||
w_get_path_at_pos() | ||||
* gives you the wrong path, the path for the cell that is 30 or so pixel | ||||
s down below the | ||||
* mouse. I don't know why it does that. Either we're doing something wro | ||||
ng, or it's a gtk-3 | ||||
* bug. | ||||
*/ | ||||
y = y - 30; | ||||
if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &t | ||||
reeColumn, &cellx, &celly)) | ||||
return FALSE; | ||||
if (!path) | ||||
return FALSE; | ||||
/* Get the color, if it's red, set tooltip to indicate device has no driv | ||||
er. */ | ||||
gtk_tree_model_get_iter(model, &iter, path); | ||||
gtk_tree_model_get(model, &iter, COLOR_COLUMN, &color, -1); | ||||
if (strncmp(color, "red", 4) == 0) { | ||||
gtk_tooltip_set_text(tooltip, "This device has no attached driver | ||||
"); | ||||
return_val = TRUE; | ||||
} | ||||
gtk_tree_path_free(path); | ||||
return return_val; | ||||
} | ||||
GtkWidget* | GtkWidget* | |||
create_windowMain () | create_windowMain () | |||
{ | { | |||
GtkWidget *vbox1; | GtkWidget *vbox1; | |||
GtkWidget *hpaned1; | GtkWidget *hpaned1; | |||
GtkWidget *scrolledwindow1; | GtkWidget *scrolledwindow1; | |||
GtkWidget *hbuttonbox1; | GtkWidget *hbuttonbox1; | |||
GtkWidget *buttonRefresh; | GtkWidget *buttonRefresh; | |||
GtkWidget *buttonConfigure; | GtkWidget *buttonConfigure; | |||
GtkWidget *buttonClose; | GtkWidget *buttonClose; | |||
GtkWidget *buttonAbout; | GtkWidget *buttonAbout; | |||
GdkPixbuf *icon; | GdkPixbuf *icon; | |||
GtkCellRenderer *treeRenderer; | GtkCellRenderer *treeRenderer; | |||
GtkTreeViewColumn *treeColumn; | ||||
windowMain = gtk_window_new (GTK_WINDOW_TOPLEVEL); | windowMain = gtk_window_new (GTK_WINDOW_TOPLEVEL); | |||
gtk_widget_set_name (windowMain, "windowMain"); | gtk_widget_set_name (windowMain, "windowMain"); | |||
gtk_window_set_title (GTK_WINDOW (windowMain), "USB Viewer"); | gtk_window_set_title (GTK_WINDOW (windowMain), "USB Viewer"); | |||
gtk_window_set_default_size (GTK_WINDOW (windowMain), 600, 300); | gtk_window_set_default_size (GTK_WINDOW (windowMain), 600, 300); | |||
icon = gdk_pixbuf_new_from_xpm_data((const char **)usbview_icon); | icon = gdk_pixbuf_new_from_xpm_data((const char **)usbview_icon); | |||
gtk_window_set_icon(GTK_WINDOW(windowMain), icon); | gtk_window_set_icon(GTK_WINDOW(windowMain), icon); | |||
vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); | vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); | |||
skipping to change at line 142 | skipping to change at line 178 | |||
NULL); | NULL); | |||
g_signal_connect (G_OBJECT (buttonConfigure), "clicked", | g_signal_connect (G_OBJECT (buttonConfigure), "clicked", | |||
G_CALLBACK (on_buttonConfigure_clicked), | G_CALLBACK (on_buttonConfigure_clicked), | |||
NULL); | NULL); | |||
g_signal_connect (G_OBJECT (buttonAbout), "clicked", | g_signal_connect (G_OBJECT (buttonAbout), "clicked", | |||
G_CALLBACK (on_buttonAbout_clicked), | G_CALLBACK (on_buttonAbout_clicked), | |||
NULL); | NULL); | |||
g_signal_connect (G_OBJECT (buttonClose), "clicked", | g_signal_connect (G_OBJECT (buttonClose), "clicked", | |||
G_CALLBACK (on_buttonClose_clicked), | G_CALLBACK (on_buttonClose_clicked), | |||
NULL); | NULL); | |||
g_object_set(G_OBJECT (treeUSB), "has-tooltip", TRUE, NULL); | ||||
g_signal_connect(G_OBJECT (treeUSB), "query-tooltip", G_CALLBACK (query_t | ||||
ooltip_cb), NULL); | ||||
/* create our timer */ | /* create our timer */ | |||
//timer = gtk_timeout_add (2000, on_timer_timeout, 0); | //timer = gtk_timeout_add (2000, on_timer_timeout, 0); | |||
return windowMain; | return windowMain; | |||
} | } | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 46 lines changed or added |