diff --git a/src/objects/actions/abstract.c b/src/objects/actions/abstract.c index 483dc1d..5851dbe 100644 --- a/src/objects/actions/abstract.c +++ b/src/objects/actions/abstract.c @@ -494,23 +494,6 @@ return G_ACTION(g_object_new(PW3270_TYPE_ACTION, NULL)); } - static GdkPixbuf * pixbuf_from_icon_name(GValue *value, gint width, gint G_GNUC_UNUSED(height), GtkIconLookupFlags flags) { - - const gchar * icon_name = g_value_get_string(value); - - if(!icon_name) - return NULL; - - return gtk_icon_theme_load_icon( - gtk_icon_theme_get_default(), - icon_name, - width, - flags, // GTK_ICON_LOOKUP_GENERIC_FALLBACK, - NULL - ); - - } - gchar * g_action_get_text(GAction *action, const gchar * property_name) { gchar *rc = NULL; @@ -540,6 +523,23 @@ return g_action_get_text(action, "icon-name"); } + static GdkPixbuf * pixbuf_from_icon_name(GValue *value, gint width, gint G_GNUC_UNUSED(height), GtkIconLookupFlags flags) { + + const gchar * icon_name = g_value_get_string(value); + + if(!icon_name) + return NULL; + + return gtk_icon_theme_load_icon( + gtk_icon_theme_get_default(), + icon_name, + width, + flags, // GTK_ICON_LOOKUP_GENERIC_FALLBACK, + NULL + ); + + } + GdkPixbuf * g_action_get_pixbuf(GAction *action, GtkIconSize icon_size, GtkIconLookupFlags flags) { struct Properties { diff --git a/src/objects/actions/button.c b/src/objects/actions/button.c index 0231688..80b599e 100644 --- a/src/objects/actions/button.c +++ b/src/objects/actions/button.c @@ -88,8 +88,6 @@ return item; } - - /// FIXME: Get size from icon_size GdkPixbuf * pixbuf = g_action_get_pixbuf(action, icon_size, GTK_ICON_LOOKUP_GENERIC_FALLBACK); if(pixbuf) { @@ -107,49 +105,7 @@ return item; } - return NULL; } - - /* - /// @brief Create a button associated with the action. - GtkWidget * pw3270_action_button_new(GAction *action, const gchar *action_name) { - - g_return_val_if_fail(PW3270_IS_ACTION(action),NULL); - - const gchar * icon_name = pw3270_action_get_icon_name(action); - - GtkWidget *image; - if(g_str_has_prefix(icon_name,"gtk-")) { - image = gtk_image_new_from_icon_name(icon_name,GTK_ICON_SIZE_BUTTON); - } else { - g_autofree gchar * symbolic_name = g_strconcat(icon_name,"-symbolic",NULL); - image = gtk_image_new_from_icon_name(symbolic_name,GTK_ICON_SIZE_BUTTON); - } - - if(!image) { - g_warning("Can't create button for icon \"%s\"",icon_name); - return NULL; - } - - GtkWidget * button = gtk_button_new(); - gtk_button_set_image(GTK_BUTTON(button), image); - - gtk_actionable_set_action_name(GTK_ACTIONABLE(button),action_name ? action_name : g_action_get_name(action)); - gtk_widget_set_visible(button,g_action_get_enabled(action)); - - gtk_widget_set_can_focus(button,FALSE); - gtk_widget_set_can_default(button,FALSE); - gtk_widget_set_focus_on_click(button,FALSE); - - const gchar * tooltip = pw3270_action_get_tooltip(action); - if(tooltip) - gtk_widget_set_tooltip_markup(button,tooltip); - - return button; - - } - */ - diff --git a/src/objects/actions/clipboard.c b/src/objects/actions/clipboard.c index 2f6bb07..aba31a9 100644 --- a/src/objects/actions/clipboard.c +++ b/src/objects/actions/clipboard.c @@ -34,120 +34,3 @@ #include "private.h" #include - - static V3270_COPY_MODE get_copy_mode_from_parameter(GVariant *parameter) { - - static const struct { - const gchar * name; - V3270_COPY_MODE value; - } targets[] = { - { "auto", V3270_COPY_DEFAULT }, - { "system", V3270_COPY_DEFAULT }, - { "default", V3270_COPY_DEFAULT }, - { "system default", V3270_COPY_DEFAULT }, - { "formatted", V3270_COPY_FORMATTED }, - { "text", V3270_COPY_TEXT }, - { "table", V3270_COPY_TABLE }, - { "append", V3270_COPY_APPEND } - - }; - - if(parameter) { - - const gchar * target = g_variant_get_string(parameter,NULL); - - if(target && *target) { - - size_t ix; - for(ix = 0; ix < G_N_ELEMENTS(targets); ix++) { - - if(!g_ascii_strcasecmp(target,targets[ix].name)) - return targets[ix].value; - - } - - } - - } - - return V3270_COPY_DEFAULT; - } - - static void activate_copy(GAction G_GNUC_UNUSED(*action), GVariant *parameter, GtkWidget *terminal) { - - debug("%s",__FUNCTION__); - v3270_clipboard_set(terminal,get_copy_mode_from_parameter(parameter),FALSE); - - } - - static void activate_cut(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - - debug("%s",__FUNCTION__); - v3270_clipboard_set(terminal,get_copy_mode_from_parameter(parameter),TRUE); - - } - - static void activate_paste(GAction G_GNUC_UNUSED(*action), GVariant *parameter, GtkWidget *terminal) { - - - if(!parameter) { - debug("%s %p",__FUNCTION__,"NULL"); - v3270_clipboard_get_from_url(terminal,NULL); - } else { - debug("%s \"%s\"",__FUNCTION__,g_variant_get_string(parameter,NULL)); - v3270_clipboard_get_from_url(terminal,g_variant_get_string(parameter,NULL)); - } - - } - - GAction * pw3270_action_copy_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_copy; - action->parent.types.parameter = G_VARIANT_TYPE_STRING; - - action->group.id = LIB3270_ACTION_GROUP_SELECTION; - action->parent.name = "copy"; - action->icon_name = "edit-copy"; - action->label = N_( "_Copy" ); - action->tooltip = N_( "Copy selected area to clipboard." ); - - return G_ACTION(action); - - } - - GAction * pw3270_action_cut_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_cut; - action->parent.types.parameter = G_VARIANT_TYPE_STRING; - - action->group.id = LIB3270_ACTION_GROUP_SELECTION; - action->parent.name = "cut"; - action->icon_name = "edit-cut"; - action->label = N_( "C_ut" ); - action->tooltip = N_( "Cut selected area." ); - - return G_ACTION(action); - - } - - GAction * pw3270_action_paste_new(void) { - - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_paste; - action->parent.types.parameter = G_VARIANT_TYPE_STRING; - - action->group.id = LIB3270_ACTION_GROUP_LOCK_STATE; - action->parent.name = "paste"; - action->icon_name = "edit-paste"; - action->label = N_( "_Paste" ); - action->tooltip = N_( "Paste text from clipboard." ); - - return G_ACTION(action); - - } diff --git a/src/objects/actions/connect.c b/src/objects/actions/connect.c index e8f6170..265791f 100644 --- a/src/objects/actions/connect.c +++ b/src/objects/actions/connect.c @@ -34,24 +34,20 @@ #include "private.h" - /* static void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { debug("%s",__FUNCTION__); gtk_widget_activate(terminal); } - */ - - /* - GAction * pw3270_action_connect_new(void) { - pw3270Action * action = PW3270_ACTION(pw3270_action_new_from_lib3270(lib3270_action_get_by_name("reconnect"))); + GAction * pw3270_action_connect_new(void) { - action->activate = activate; - action->name = "connect"; + pw3270SimpleAction * action = pw3270_simple_action_new_from_lib3270(lib3270_action_get_by_name("reconnect"),"connect"); + action->parent.activate = activate; + action->label = N_("Connect"); + action->tooltip = N_("Connect to host"); return G_ACTION(action); } - */ diff --git a/src/objects/actions/print.c b/src/objects/actions/print.c index 651af88..cdcc3c2 100644 --- a/src/objects/actions/print.c +++ b/src/objects/actions/print.c @@ -36,75 +36,3 @@ #include #include - /* - static void activate_print_all(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - debug("%s",__FUNCTION__); - v3270_print_all(terminal,NULL); - } - - static void activate_print_selected(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - debug("%s",__FUNCTION__); - v3270_print_selected(terminal,NULL); - } - - static void activate_print(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - - debug("%s",__FUNCTION__); - - } - - void pw3270_application_print_copy_activated(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - - debug("%s",__FUNCTION__); - v3270_print_copy(terminal,NULL); - - } - - GAction * pw3270_action_print_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_print; -// action->parent.types.parameter = G_VARIANT_TYPE_STRING; - - action->group.id = LIB3270_ACTION_GROUP_ONLINE; - action->parent.name = "print"; - action->label = N_( "Print" ); - action->icon_name = "printer"; - action->tooltip = N_( "Print terminal contents or selected area." ); - - return G_ACTION(action); - - } - - GAction * pw3270_action_print_all_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_print_all; - - action->group.id = LIB3270_ACTION_GROUP_ONLINE; - action->parent.name = "print.screen"; - action->icon_name = "printer"; - action->label = N_( "Print screen" ); - - return G_ACTION(action); - - } - - GAction * pw3270_action_print_selected_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_print_selected; - - action->group.id = LIB3270_ACTION_GROUP_SELECTION; - action->parent.name = "print.selected"; - action->icon_name = "printer"; - action->label = N_( "Print selected" ); - - return G_ACTION(action); - - } - */ - diff --git a/src/objects/actions/private.h b/src/objects/actions/private.h index fc42c01..22c61fc 100644 --- a/src/objects/actions/private.h +++ b/src/objects/actions/private.h @@ -57,19 +57,6 @@ G_GNUC_INTERNAL void pw3270_action_notify_state(GAction *object); // Internal actions -// G_GNUC_INTERNAL GAction * pw3270_action_connect_new(void); - G_GNUC_INTERNAL GAction * pw3270_action_copy_new(void); - G_GNUC_INTERNAL GAction * pw3270_action_cut_new(void); - G_GNUC_INTERNAL GAction * pw3270_action_paste_new(void); - - /* - G_GNUC_INTERNAL GAction * pw3270_action_save_new(void); - G_GNUC_INTERNAL GAction * pw3270_action_save_screen_new(void); - G_GNUC_INTERNAL GAction * pw3270_action_save_selected_new(void); - - G_GNUC_INTERNAL GAction * pw3270_action_print_new(void); - G_GNUC_INTERNAL GAction * pw3270_action_print_all_new(void); - G_GNUC_INTERNAL GAction * pw3270_action_print_selected_new(void); - */ + G_GNUC_INTERNAL GAction * pw3270_action_connect_new(void); #endif // PRIVATE_H_INCLUDED diff --git a/src/objects/actions/save.c b/src/objects/actions/save.c index f7c7892..0a83318 100644 --- a/src/objects/actions/save.c +++ b/src/objects/actions/save.c @@ -36,72 +36,3 @@ #include #include - /* - static void activate_save_screen(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - debug("%s",__FUNCTION__); - v3270_save_all(terminal,NULL,NULL); - } - - static void activate_save_selected(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - debug("%s",__FUNCTION__); - v3270_save_selected(terminal,NULL,NULL); - } - - void pw3270_application_save_copy_activated(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - debug("%s",__FUNCTION__); - v3270_save_copy(terminal,NULL,NULL); - } - - static void activate_save(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - - debug("%s",__FUNCTION__); - - } - - GAction * pw3270_action_save_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_save; - action->parent.types.parameter = G_VARIANT_TYPE_STRING; - - action->group.id = LIB3270_ACTION_GROUP_ONLINE; - action->parent.name = "save"; - action->icon_name = "document-save"; - action->label = N_( "_Save" ); - action->tooltip = N_( "Save terminal contents." ); - - return G_ACTION(action); - - } - - GAction * pw3270_action_save_screen_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_save_screen; - - action->group.id = LIB3270_ACTION_GROUP_ONLINE; - action->parent.name = "save.screen"; - action->icon_name = "document-save"; - action->label = N_( "Save screen" ); - - return G_ACTION(action); - - } - - GAction * pw3270_action_save_selected_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate_save_selected; - - action->group.id = LIB3270_ACTION_GROUP_SELECTION; - action->parent.name = "save.selected"; - action->icon_name = "document-save"; - action->label = N_( "Save selected" ); - - return G_ACTION(action); - - } -*/ diff --git a/src/objects/actions/window.c b/src/objects/actions/window.c index 1b1f020..a6fb49c 100644 --- a/src/objects/actions/window.c +++ b/src/objects/actions/window.c @@ -37,72 +37,3 @@ #include #include -/* - void pw3270_window_add_actions(GtkWidget * appwindow) { - - GActionMap * map = G_ACTION_MAP(appwindow); - size_t ix; - - // Map lib3270 actions - { - const LIB3270_ACTION * actions = lib3270_get_actions(); - for(ix = 0; actions[ix].name; ix++) { - - GAction *action = g_action_new_from_lib3270(&actions[ix]); - g_action_map_add_action(map,action); - - } - } - - // Map toggles - { - const LIB3270_TOGGLE * toggles = lib3270_get_toggles(); - for(ix = 0; toggles[ix].name; ix++) { - - GAction *action = g_action_new_from_toggle(&toggles[ix]); - g_action_map_add_action(map,action); - - } - } - - // Map V3270 actions - { - const V3270_ACTION * actions = v3270_get_actions(); - - for(ix = 0; actions[ix].name; ix++) { - GAction * action = v3270_action_new(&actions[ix]); - g_action_map_add_action(map,action); - } - - } - - // Map special actions - { - GAction * actions[] = { - v3270_pfkey_action_new(), - v3270_pakey_action_new(), -// pw3270_action_connect_new(), -// pw3270_action_copy_new(), -// pw3270_action_cut_new(), -// pw3270_action_paste_new(), - -// pw3270_action_save_new(), -// pw3270_action_save_screen_new(), -// pw3270_action_save_selected_new(), - -// pw3270_action_print_new(), -// pw3270_action_print_all_new(), -// pw3270_action_print_selected_new(), - - }; - - for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) { - debug("Creating action %u (names=%s ptype=%s)", (unsigned int) ix, g_action_get_name(actions[ix]), (const char *) g_action_get_parameter_type(actions[ix])); - g_action_map_add_action(map,actions[ix]); - } - } - - debug("%s ends",__FUNCTION__); - - } -*/ diff --git a/src/objects/window/actions/setcolors.c b/src/objects/window/actions/setcolors.c index 9443905..a12c50c 100644 --- a/src/objects/window/actions/setcolors.c +++ b/src/objects/window/actions/setcolors.c @@ -50,7 +50,7 @@ GtkWidget * factory(GtkWidget *terminal) { - return v3270_settings_get_edit_dialog(v3270_color_selection_new(),terminal,FALSE); + return v3270_settings_get_edit_dialog(v3270_color_settings_new(),terminal,FALSE); } diff --git a/src/objects/window/window.c b/src/objects/window/window.c index bb9d899..c9f6c24 100644 --- a/src/objects/window/window.c +++ b/src/objects/window/window.c @@ -166,6 +166,8 @@ pw3270_action_window_close_new(), + pw3270_action_connect_new(), + }; for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) { -- libgit2 0.21.2