Commit 60dd822f344146a31e9913325c02b94fc91aed24
1 parent
be8f5790
Exists in
master
and in
4 other branches
Working on "paste" actions.
Showing
3 changed files
with
56 additions
and
6 deletions
Show diff stats
src/objects/actions/clipboard.c
@@ -51,11 +51,12 @@ | @@ -51,11 +51,12 @@ | ||
51 | 51 | ||
52 | static void activate_paste(GAction G_GNUC_UNUSED(*action), GVariant *parameter, GtkWidget *terminal) { | 52 | static void activate_paste(GAction G_GNUC_UNUSED(*action), GVariant *parameter, GtkWidget *terminal) { |
53 | 53 | ||
54 | - debug("%s %p",__FUNCTION__,parameter); | ||
55 | 54 | ||
56 | if(!parameter) { | 55 | if(!parameter) { |
57 | - v3270_paste(terminal); | 56 | + debug("%s %p",__FUNCTION__,"NULL"); |
57 | + v3270_paste_from_url(terminal,NULL); | ||
58 | } else { | 58 | } else { |
59 | + debug("%s \"%s\"",__FUNCTION__,g_variant_get_string(parameter,NULL)); | ||
59 | v3270_paste_from_url(terminal,g_variant_get_string(parameter,NULL)); | 60 | v3270_paste_from_url(terminal,g_variant_get_string(parameter,NULL)); |
60 | } | 61 | } |
61 | 62 | ||
@@ -63,6 +64,7 @@ | @@ -63,6 +64,7 @@ | ||
63 | 64 | ||
64 | GAction * pw3270_copy_action_new(void) { | 65 | GAction * pw3270_copy_action_new(void) { |
65 | 66 | ||
67 | + /* | ||
66 | static const LIB3270_ACTION action_descriptor = { | 68 | static const LIB3270_ACTION action_descriptor = { |
67 | .name = "copy", | 69 | .name = "copy", |
68 | .type = LIB3270_ACTION_TYPE_SELECTION, | 70 | .type = LIB3270_ACTION_TYPE_SELECTION, |
@@ -82,12 +84,28 @@ | @@ -82,12 +84,28 @@ | ||
82 | 84 | ||
83 | PW3270_ACTION(action)->activate = activate_copy; | 85 | PW3270_ACTION(action)->activate = activate_copy; |
84 | 86 | ||
87 | + | ||
85 | return action; | 88 | return action; |
86 | 89 | ||
90 | + | ||
91 | + */ | ||
92 | + | ||
93 | + pw3270SimpleAction * action = pw3270_simple_action_new(); | ||
94 | + | ||
95 | + action->parent.activate = activate_copy; | ||
96 | + action->group.id = LIB3270_ACTION_GROUP_SELECTION; | ||
97 | + action->parent.name = "file.transfer"; | ||
98 | + action->icon_name = "edit-copy"; | ||
99 | + action->label = N_( "_Copy" ); | ||
100 | + action->tooltip = N_( "Copy selected area to clipboard." ); | ||
101 | + | ||
102 | + return G_ACTION(action); | ||
103 | + | ||
87 | } | 104 | } |
88 | 105 | ||
89 | GAction * pw3270_cut_action_new(void) { | 106 | GAction * pw3270_cut_action_new(void) { |
90 | 107 | ||
108 | + /* | ||
91 | static const LIB3270_ACTION action_descriptor = { | 109 | static const LIB3270_ACTION action_descriptor = { |
92 | .name = "cut", | 110 | .name = "cut", |
93 | .type = LIB3270_ACTION_TYPE_SELECTION, | 111 | .type = LIB3270_ACTION_TYPE_SELECTION, |
@@ -108,11 +126,24 @@ | @@ -108,11 +126,24 @@ | ||
108 | PW3270_ACTION(action)->activate = activate_cut; | 126 | PW3270_ACTION(action)->activate = activate_cut; |
109 | 127 | ||
110 | return action; | 128 | return action; |
129 | + */ | ||
130 | + | ||
131 | + pw3270SimpleAction * action = pw3270_simple_action_new(); | ||
132 | + | ||
133 | + action->parent.activate = activate_cut; | ||
134 | + action->group.id = LIB3270_ACTION_GROUP_SELECTION; | ||
135 | + action->parent.name = "file.transfer"; | ||
136 | + action->icon_name = "edit-cut"; | ||
137 | + action->label = N_( "C_ut" ); | ||
138 | + action->tooltip = N_( "Cut selected area." ); | ||
139 | + | ||
140 | + return G_ACTION(action); | ||
111 | 141 | ||
112 | } | 142 | } |
113 | 143 | ||
114 | GAction * pw3270_paste_action_new(void) { | 144 | GAction * pw3270_paste_action_new(void) { |
115 | 145 | ||
146 | + /* | ||
116 | static const LIB3270_ACTION action_descriptor = { | 147 | static const LIB3270_ACTION action_descriptor = { |
117 | .name = "paste", | 148 | .name = "paste", |
118 | .type = LIB3270_ACTION_TYPE_SELECTION, | 149 | .type = LIB3270_ACTION_TYPE_SELECTION, |
@@ -134,5 +165,19 @@ | @@ -134,5 +165,19 @@ | ||
134 | action->activate = activate_paste; | 165 | action->activate = activate_paste; |
135 | 166 | ||
136 | return G_ACTION(action); | 167 | return G_ACTION(action); |
168 | + */ | ||
169 | + | ||
170 | + pw3270SimpleAction * action = pw3270_simple_action_new(); | ||
171 | + | ||
172 | + action->parent.activate = activate_paste; | ||
173 | + action->parent.types.parameter = G_VARIANT_TYPE_STRING; | ||
174 | + | ||
175 | + action->group.id = LIB3270_ACTION_GROUP_LOCK_STATE; | ||
176 | + action->parent.name = "paste"; | ||
177 | + action->icon_name = "edit-paste"; | ||
178 | + action->label = N_( "_Paste" ); | ||
179 | + action->tooltip = N_( "Paste text from clipboard." ); | ||
180 | + | ||
181 | + return G_ACTION(action); | ||
137 | 182 | ||
138 | } | 183 | } |
src/objects/toolbar/actions.c
@@ -60,8 +60,8 @@ | @@ -60,8 +60,8 @@ | ||
60 | 60 | ||
61 | if(window) { | 61 | if(window) { |
62 | 62 | ||
63 | - GAction *action = g_action_map_lookup_action(G_ACTION_MAP(window), name); | ||
64 | GtkToolItem * item = NULL; | 63 | GtkToolItem * item = NULL; |
64 | + GAction *action = g_action_map_lookup_action(G_ACTION_MAP(window), name); | ||
65 | 65 | ||
66 | if(!action) { | 66 | if(!action) { |
67 | const gchar *ptr = strchr(name,'.'); | 67 | const gchar *ptr = strchr(name,'.'); |
@@ -79,7 +79,14 @@ | @@ -79,7 +79,14 @@ | ||
79 | } | 79 | } |
80 | 80 | ||
81 | if(item) { | 81 | if(item) { |
82 | - gtk_actionable_set_action_name(GTK_ACTIONABLE(item),name); | 82 | + |
83 | + if(action && g_action_get_parameter_type(action) == G_VARIANT_TYPE_STRING) { | ||
84 | + g_autofree gchar * detailed = g_strconcat(name,"::",NULL); | ||
85 | + gtk_actionable_set_detailed_action_name(GTK_ACTIONABLE(item),detailed); | ||
86 | + } else { | ||
87 | + gtk_actionable_set_action_name(GTK_ACTIONABLE(item),name); | ||
88 | + } | ||
89 | + | ||
83 | gtk_toolbar_insert(GTK_TOOLBAR(toolbar),item,pos); | 90 | gtk_toolbar_insert(GTK_TOOLBAR(toolbar),item,pos); |
84 | return GTK_WIDGET(item); | 91 | return GTK_WIDGET(item); |
85 | } | 92 | } |
src/objects/window/window.c
@@ -170,8 +170,6 @@ | @@ -170,8 +170,6 @@ | ||
170 | 170 | ||
171 | GtkWidget * pw3270_application_window_new(GtkApplication * application) { | 171 | GtkWidget * pw3270_application_window_new(GtkApplication * application) { |
172 | 172 | ||
173 | - size_t ix; | ||
174 | - | ||
175 | const gchar * title = _( "IBM 3270 Terminal emulator" ); | 173 | const gchar * title = _( "IBM 3270 Terminal emulator" ); |
176 | 174 | ||
177 | g_autoptr(GSettings) settings = pw3270_application_get_settings(G_APPLICATION(application)); | 175 | g_autoptr(GSettings) settings = pw3270_application_get_settings(G_APPLICATION(application)); |