Commit c3f43bd39bbd9a32bb3156e82fab87be2942614a
1 parent
2f519025
Exists in
master
and in
4 other branches
Implementing popup menu on window tabs.
Showing
1 changed file
with
47 additions
and
1 deletions
Show diff stats
src/objects/window/page.c
@@ -34,6 +34,42 @@ | @@ -34,6 +34,42 @@ | ||
34 | #include <v3270/actions.h> | 34 | #include <v3270/actions.h> |
35 | #include <v3270/print.h> | 35 | #include <v3270/print.h> |
36 | 36 | ||
37 | +//---[ Gtk Label with customized popup-menu ]--------------------------------------------------------------------------------------- | ||
38 | + typedef struct _pw3270TabLabel { | ||
39 | + | ||
40 | + GtkLabel parent; | ||
41 | + | ||
42 | + } pw3270TabLabel; | ||
43 | + | ||
44 | + typedef struct _pw3270TabLabelClass { | ||
45 | + | ||
46 | + GtkLabelClass parent_class; | ||
47 | + | ||
48 | + } pw3270TabLabelClass; | ||
49 | + | ||
50 | + G_DEFINE_TYPE(pw3270TabLabel, pw3270TabLabel, GTK_TYPE_LABEL); | ||
51 | + | ||
52 | + | ||
53 | + static gboolean tab_label_button_press(GtkWidget *widget, GdkEventButton *event) { | ||
54 | + | ||
55 | + debug("%s(%u)",__FUNCTION__,event->button); | ||
56 | + | ||
57 | + | ||
58 | + return FALSE; | ||
59 | + } | ||
60 | + | ||
61 | + static void pw3270TabLabel_class_init(pw3270TabLabelClass *klass) { | ||
62 | + | ||
63 | + GTK_WIDGET_CLASS(klass)->button_press_event = tab_label_button_press; | ||
64 | + | ||
65 | + } | ||
66 | + | ||
67 | + static void pw3270TabLabel_init(pw3270TabLabel *widget) { | ||
68 | + | ||
69 | + } | ||
70 | + | ||
71 | +//---------------------------------------------------------------------------------------------------------------------------------- | ||
72 | + | ||
37 | static gboolean on_terminal_focus(GtkWidget *terminal, GdkEvent G_GNUC_UNUSED(*event), GtkWindow * window); | 73 | static gboolean on_terminal_focus(GtkWidget *terminal, GdkEvent G_GNUC_UNUSED(*event), GtkWindow * window); |
38 | static void session_changed(GtkWidget *terminal, GtkWidget *label); | 74 | static void session_changed(GtkWidget *terminal, GtkWidget *label); |
39 | static void disconnected(GtkWidget *terminal, GtkWindow * window); | 75 | static void disconnected(GtkWidget *terminal, GtkWindow * window); |
@@ -44,7 +80,17 @@ | @@ -44,7 +80,17 @@ | ||
44 | 80 | ||
45 | gint pw3270_application_window_append_page(pw3270ApplicationWindow * window, GtkWidget * terminal) { | 81 | gint pw3270_application_window_append_page(pw3270ApplicationWindow * window, GtkWidget * terminal) { |
46 | 82 | ||
47 | - GtkWidget * label = gtk_label_new(v3270_get_session_name(terminal)); | 83 | + GtkWidget * label = |
84 | + GTK_WIDGET( | ||
85 | + g_object_new( | ||
86 | + pw3270TabLabel_get_type(), | ||
87 | + "label", v3270_get_session_name(terminal), | ||
88 | + "selectable", TRUE, | ||
89 | + NULL) | ||
90 | + ); | ||
91 | + | ||
92 | + // gtk_label_new(v3270_get_session_name(terminal)); | ||
93 | + | ||
48 | GtkWidget * tab = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); | 94 | GtkWidget * tab = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); |
49 | GtkWidget * button = gtk_button_new_from_icon_name("window-close-symbolic",GTK_ICON_SIZE_MENU); | 95 | GtkWidget * button = gtk_button_new_from_icon_name("window-close-symbolic",GTK_ICON_SIZE_MENU); |
50 | 96 |