Commit 726bfb707cbd24b07f33ec82872dceb9adc6bb0d

Authored by Perry Werneck
1 parent 54d771e6

Working on the new interface.

src/objects/window/application.c
@@ -85,6 +85,7 @@ @@ -85,6 +85,7 @@
85 .name = "about", 85 .name = "about",
86 .activate = pw3270_application_generic_activated, 86 .activate = pw3270_application_generic_activated,
87 }, 87 },
  88 +
88 { 89 {
89 .name = "preferences", 90 .name = "preferences",
90 .activate = pw3270_application_generic_activated, 91 .activate = pw3270_application_generic_activated,
@@ -96,15 +97,29 @@ @@ -96,15 +97,29 @@
96 }, 97 },
97 98
98 { 99 {
99 - .name = "new_tab", 100 + .name = "new.tab",
100 .activate = pw3270_application_new_tab_activated, 101 .activate = pw3270_application_new_tab_activated,
101 }, 102 },
102 103
103 { 104 {
104 - .name = "new_window", 105 + .name = "new.window",
105 .activate = pw3270_application_new_window_activated, 106 .activate = pw3270_application_new_window_activated,
106 - } 107 + },
  108 +
  109 + {
  110 + .name = "open",
  111 + .activate = pw3270_application_generic_activated,
  112 + },
  113 +
  114 + {
  115 + .name = "open.tab",
  116 + .activate = pw3270_application_generic_activated,
  117 + },
107 118
  119 + {
  120 + .name = "open.window",
  121 + .activate = pw3270_application_generic_activated,
  122 + },
108 }; 123 };
109 124
110 g_action_map_add_action_entries( 125 g_action_map_add_action_entries(
@@ -164,6 +179,3 @@ @@ -164,6 +179,3 @@
164 179
165 } 180 }
166 181
167 - PW3270_UI_TYPE pw3270_application_get_ui_type(GApplication *app) {  
168 - return PW3270_UI_STYLE_GNOME;  
169 - }  
src/objects/window/private.h
@@ -61,6 +61,9 @@ @@ -61,6 +61,9 @@
61 61
62 }; 62 };
63 63
  64 + // Internal methods
  65 + G_GNUC_INTERNAL GtkWidget * pw3270_setup_image_button(GtkWidget *button, const gchar *image_name);
  66 +
64 // Actions 67 // Actions
65 G_GNUC_INTERNAL void pw3270_application_generic_activated(GSimpleAction * action, GVariant *parameter, gpointer application); 68 G_GNUC_INTERNAL void pw3270_application_generic_activated(GSimpleAction * action, GVariant *parameter, gpointer application);
66 G_GNUC_INTERNAL void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application); 69 G_GNUC_INTERNAL void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application);
src/objects/window/testprogram/testprogram.c
@@ -88,4 +88,8 @@ int main (int argc, char **argv) { @@ -88,4 +88,8 @@ int main (int argc, char **argv) {
88 88
89 } 89 }
90 90
  91 +PW3270_UI_TYPE pw3270_application_get_ui_type(GApplication *app) {
  92 + return PW3270_UI_STYLE_GNOME;
  93 +}
  94 +
91 95
src/objects/window/ui/application.xml
@@ -9,11 +9,7 @@ @@ -9,11 +9,7 @@
9 </item> 9 </item>
10 <item> 10 <item>
11 <attribute name="label" translatable="yes">New Window</attribute> 11 <attribute name="label" translatable="yes">New Window</attribute>
12 - <attribute name="action">app.new_window</attribute>  
13 - </item>  
14 - <item>  
15 - <attribute name="label" translatable="yes">Preferences</attribute>  
16 - <attribute name="action">app.help</attribute> 12 + <attribute name="action">app.new.window</attribute>
17 </item> 13 </item>
18 <item> 14 <item>
19 <attribute name="label" translatable="yes">Quit</attribute> 15 <attribute name="label" translatable="yes">Quit</attribute>
@@ -24,21 +20,46 @@ @@ -24,21 +20,46 @@
24 20
25 <menu id='menubar'> 21 <menu id='menubar'>
26 <submenu> 22 <submenu>
  23 + <attribute name='label' translatable='yes'>_Session</attribute>
  24 +
  25 + <item>
  26 + <attribute name="label" translatable="yes">Open</attribute>
  27 + <attribute name="action">win.open</attribute>
  28 + </item>
  29 +
  30 + <item>
  31 + <attribute name="label" translatable="yes">Close</attribute>
  32 + <attribute name="action">win.close</attribute>
  33 + </item>
  34 +
  35 + <item>
  36 + <attribute name="label" translatable="yes">Open in new window</attribute>
  37 + <attribute name="action">app.open.window</attribute>
  38 + </item>
  39 +
  40 + <item>
  41 + <attribute name="label" translatable="yes">Open in new tab</attribute>
  42 + <attribute name="action">app.open.tab</attribute>
  43 + </item>
  44 +
  45 + </submenu>
  46 +
  47 + <submenu>
27 <attribute name='label' translatable='yes'>_Edit</attribute> 48 <attribute name='label' translatable='yes'>_Edit</attribute>
28 <section> 49 <section>
29 <item> 50 <item>
30 <attribute name='label' translatable='yes'>_Copy</attribute> 51 <attribute name='label' translatable='yes'>_Copy</attribute>
31 - <attribute name='action'>app.quit</attribute> 52 + <attribute name='action'>app.default</attribute>
32 </item> 53 </item>
33 <item> 54 <item>
34 <attribute name='label' translatable='yes'>_Paste</attribute> 55 <attribute name='label' translatable='yes'>_Paste</attribute>
35 - <attribute name='action'>app.quit</attribute> 56 + <attribute name='action'>app.default</attribute>
36 </item> 57 </item>
37 </section> 58 </section>
38 <section> 59 <section>
39 <item> 60 <item>
40 <attribute name='label' translatable='yes'>Plugins</attribute> 61 <attribute name='label' translatable='yes'>Plugins</attribute>
41 - <attribute name='action'>app.quit</attribute> 62 + <attribute name='action'>app.default</attribute>
42 </item> 63 </item>
43 </section> 64 </section>
44 </submenu> 65 </submenu>
src/objects/window/ui/window.xml
@@ -8,11 +8,11 @@ @@ -8,11 +8,11 @@
8 <attribute name="label" translatable="yes">New</attribute> 8 <attribute name="label" translatable="yes">New</attribute>
9 <item> 9 <item>
10 <attribute name="label" translatable="yes">Tab</attribute> 10 <attribute name="label" translatable="yes">Tab</attribute>
11 - <attribute name="action">app.new_tab</attribute> 11 + <attribute name="action">app.new.tab</attribute>
12 </item> 12 </item>
13 <item> 13 <item>
14 <attribute name="label" translatable="yes">Application Window</attribute> 14 <attribute name="label" translatable="yes">Application Window</attribute>
15 - <attribute name="action">app.new_window</attribute> 15 + <attribute name="action">app.new.window</attribute>
16 </item> 16 </item>
17 </submenu> 17 </submenu>
18 18
@@ -24,11 +24,11 @@ @@ -24,11 +24,11 @@
24 </item> 24 </item>
25 <item> 25 <item>
26 <attribute name="label" translatable="yes">New tab</attribute> 26 <attribute name="label" translatable="yes">New tab</attribute>
27 - <attribute name="action">app.new_tab</attribute> 27 + <attribute name="action">app.new.tab</attribute>
28 </item> 28 </item>
29 <item> 29 <item>
30 <attribute name="label" translatable="yes">New window</attribute> 30 <attribute name="label" translatable="yes">New window</attribute>
31 - <attribute name="action">app.new_window</attribute> 31 + <attribute name="action">app.new.window</attribute>
32 </item> 32 </item>
33 </submenu> 33 </submenu>
34 34
src/objects/window/window.c
@@ -74,6 +74,16 @@ @@ -74,6 +74,16 @@
74 static GActionEntry actions[] = { 74 static GActionEntry actions[] = {
75 75
76 { 76 {
  77 + .name = "open",
  78 + .activate = pw3270_application_generic_activated,
  79 + },
  80 +
  81 + {
  82 + .name = "close",
  83 + .activate = pw3270_application_generic_activated,
  84 + },
  85 +
  86 + {
77 .name = "preferences", 87 .name = "preferences",
78 .activate = pw3270_application_generic_activated, 88 .activate = pw3270_application_generic_activated,
79 }, 89 },
@@ -125,17 +135,13 @@ @@ -125,17 +135,13 @@
125 135
126 // Create gear button 136 // Create gear button
127 // https://wiki.gnome.org/Initiatives/GnomeGoals/GearIcons 137 // https://wiki.gnome.org/Initiatives/GnomeGoals/GearIcons
128 - GtkWidget * gear_menu = gtk_menu_button_new();  
129 - gtk_button_set_image(GTK_BUTTON(gear_menu),gtk_image_new_from_icon_name("open-menu-symbolic",GTK_ICON_SIZE_MENU));  
130 - 138 + GtkWidget * gear_menu = pw3270_setup_image_button(gtk_menu_button_new(),"open-menu-symbolic");
131 gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(gear_menu), G_MENU_MODEL(gtk_builder_get_object (builder, "gear-menu"))); 139 gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(gear_menu), G_MENU_MODEL(gtk_builder_get_object (builder, "gear-menu")));
132 -  
133 gtk_header_bar_pack_end(header, gear_menu); 140 gtk_header_bar_pack_end(header, gear_menu);
134 141
135 // Create "new tab" bar 142 // Create "new tab" bar
136 - GtkWidget * new_tab_button = gtk_button_new_from_icon_name("tab-new-symbolic",GTK_ICON_SIZE_MENU); 143 + GtkWidget * new_tab_button = pw3270_setup_image_button(gtk_button_new(),"tab-new-symbolic");
137 gtk_actionable_set_action_name(GTK_ACTIONABLE(new_tab_button),"app.new_tab"); 144 gtk_actionable_set_action_name(GTK_ACTIONABLE(new_tab_button),"app.new_tab");
138 -  
139 gtk_header_bar_pack_start(header, new_tab_button); 145 gtk_header_bar_pack_start(header, new_tab_button);
140 146
141 // Show the new header 147 // Show the new header
src/objects/window/window.cbp
@@ -55,6 +55,9 @@ @@ -55,6 +55,9 @@
55 <Unit filename="testprogram/testprogram.c"> 55 <Unit filename="testprogram/testprogram.c">
56 <Option compilerVar="CC" /> 56 <Option compilerVar="CC" />
57 </Unit> 57 </Unit>
  58 + <Unit filename="tools.c">
  59 + <Option compilerVar="CC" />
  60 + </Unit>
58 <Unit filename="window.c"> 61 <Unit filename="window.c">
59 <Option compilerVar="CC" /> 62 <Option compilerVar="CC" />
60 </Unit> 63 </Unit>