Commit 726bfb707cbd24b07f33ec82872dceb9adc6bb0d

Authored by Perry Werneck
1 parent 54d771e6

Working on the new interface.

src/objects/window/application.c
... ... @@ -85,6 +85,7 @@
85 85 .name = "about",
86 86 .activate = pw3270_application_generic_activated,
87 87 },
  88 +
88 89 {
89 90 .name = "preferences",
90 91 .activate = pw3270_application_generic_activated,
... ... @@ -96,15 +97,29 @@
96 97 },
97 98  
98 99 {
99   - .name = "new_tab",
  100 + .name = "new.tab",
100 101 .activate = pw3270_application_new_tab_activated,
101 102 },
102 103  
103 104 {
104   - .name = "new_window",
  105 + .name = "new.window",
105 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 125 g_action_map_add_action_entries(
... ... @@ -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 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 67 // Actions
65 68 G_GNUC_INTERNAL void pw3270_application_generic_activated(GSimpleAction * action, GVariant *parameter, gpointer application);
66 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 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 9 </item>
10 10 <item>
11 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 13 </item>
18 14 <item>
19 15 <attribute name="label" translatable="yes">Quit</attribute>
... ... @@ -24,21 +20,46 @@
24 20  
25 21 <menu id='menubar'>
26 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 48 <attribute name='label' translatable='yes'>_Edit</attribute>
28 49 <section>
29 50 <item>
30 51 <attribute name='label' translatable='yes'>_Copy</attribute>
31   - <attribute name='action'>app.quit</attribute>
  52 + <attribute name='action'>app.default</attribute>
32 53 </item>
33 54 <item>
34 55 <attribute name='label' translatable='yes'>_Paste</attribute>
35   - <attribute name='action'>app.quit</attribute>
  56 + <attribute name='action'>app.default</attribute>
36 57 </item>
37 58 </section>
38 59 <section>
39 60 <item>
40 61 <attribute name='label' translatable='yes'>Plugins</attribute>
41   - <attribute name='action'>app.quit</attribute>
  62 + <attribute name='action'>app.default</attribute>
42 63 </item>
43 64 </section>
44 65 </submenu>
... ...
src/objects/window/ui/window.xml
... ... @@ -8,11 +8,11 @@
8 8 <attribute name="label" translatable="yes">New</attribute>
9 9 <item>
10 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 12 </item>
13 13 <item>
14 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 16 </item>
17 17 </submenu>
18 18  
... ... @@ -24,11 +24,11 @@
24 24 </item>
25 25 <item>
26 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 28 </item>
29 29 <item>
30 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 32 </item>
33 33 </submenu>
34 34  
... ...
src/objects/window/window.c
... ... @@ -74,6 +74,16 @@
74 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 87 .name = "preferences",
78 88 .activate = pw3270_application_generic_activated,
79 89 },
... ... @@ -125,17 +135,13 @@
125 135  
126 136 // Create gear button
127 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 139 gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(gear_menu), G_MENU_MODEL(gtk_builder_get_object (builder, "gear-menu")));
132   -
133 140 gtk_header_bar_pack_end(header, gear_menu);
134 141  
135 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 144 gtk_actionable_set_action_name(GTK_ACTIONABLE(new_tab_button),"app.new_tab");
138   -
139 145 gtk_header_bar_pack_start(header, new_tab_button);
140 146  
141 147 // Show the new header
... ...
src/objects/window/window.cbp
... ... @@ -55,6 +55,9 @@
55 55 <Unit filename="testprogram/testprogram.c">
56 56 <Option compilerVar="CC" />
57 57 </Unit>
  58 + <Unit filename="tools.c">
  59 + <Option compilerVar="CC" />
  60 + </Unit>
58 61 <Unit filename="window.c">
59 62 <Option compilerVar="CC" />
60 63 </Unit>
... ...