/*
* Geeqie
* (C) 2004 John Ellis
- * Copyright (C) 2008 - 2010 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
*
* Author: John Ellis
*
*/
static guint tree_key_overrides[] = {
- GDK_Page_Up, GDK_KP_Page_Up,
- GDK_Page_Down, GDK_KP_Page_Down,
- GDK_Home, GDK_KP_Home,
- GDK_End, GDK_KP_End
+ GDK_KEY_Page_Up, GDK_KEY_KP_Page_Up,
+ GDK_KEY_Page_Down, GDK_KEY_KP_Page_Down,
+ GDK_KEY_Home, GDK_KEY_KP_Home,
+ GDK_KEY_End, GDK_KEY_KP_End
};
static gboolean layout_key_match(guint keyval)
gboolean layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
LayoutWindow *lw = data;
+ GtkWidget *focused;
gboolean stop_signal = FALSE;
gint x = 0;
gint y = 0;
-#if GTK_CHECK_VERSION(2,20,0)
if (lw->path_entry && gtk_widget_has_focus(lw->path_entry))
-#else
- if (lw->path_entry && GTK_WIDGET_HAS_FOCUS(lw->path_entry))
-#endif
{
- if (event->keyval == GDK_Escape && lw->dir_fd)
+ if (event->keyval == GDK_KEY_Escape && lw->dir_fd)
{
gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->dir_fd->path);
}
return TRUE;
}
}
-#if GTK_CHECK_VERSION(2,20,0)
if (lw->vd && lw->options.dir_view_type == DIRVIEW_TREE && gtk_widget_has_focus(lw->vd->view) &&
-#else
- if (lw->vd && lw->options.dir_view_type == DIRVIEW_TREE && GTK_WIDGET_HAS_FOCUS(lw->vd->view) &&
-#endif
!layout_key_match(event->keyval) &&
gtk_widget_event(lw->vd->view, (GdkEvent *)event))
{
return TRUE;
}
-/*
- if (event->type == GDK_KEY_PRESS && lw->full_screen &&
- gtk_accel_groups_activate(G_OBJECT(lw->window), event->keyval, event->state))
- return TRUE;
-*/
-
+ focused = gtk_container_get_focus_child(GTK_CONTAINER(lw->image->widget));
if (lw->image &&
-#if GTK_CHECK_VERSION(2,20,0)
- (gtk_widget_has_focus(lw->image->widget) || (lw->tools && widget == lw->window) || lw->full_screen) )
-#else
- (GTK_WIDGET_HAS_FOCUS(lw->image->widget) || (lw->tools && widget == lw->window) || lw->full_screen) )
-#endif
+ ((focused && gtk_widget_has_focus(focused)) || (lw->tools && widget == lw->window) || lw->full_screen) )
{
stop_signal = TRUE;
switch (event->keyval)
{
- case GDK_Left: case GDK_KP_Left:
+ case GDK_KEY_Left: case GDK_KEY_KP_Left:
x -= 1;
break;
- case GDK_Right: case GDK_KP_Right:
+ case GDK_KEY_Right: case GDK_KEY_KP_Right:
x += 1;
break;
- case GDK_Up: case GDK_KP_Up:
+ case GDK_KEY_Up: case GDK_KEY_KP_Up:
y -= 1;
break;
- case GDK_Down: case GDK_KP_Down:
+ case GDK_KEY_Down: case GDK_KEY_KP_Down:
y += 1;
break;
default:
stop_signal = TRUE;
switch (event->keyval)
{
- case GDK_Menu:
+ case GDK_KEY_Menu:
layout_image_menu_popup(lw);
break;
default:
LayoutWindow *lw = data;
layout_exit_fullscreen(lw);
-
- /* FIXME:interrupting thumbs no longer allowed */
-#if 0
- interrupt_thumbs();
-#endif
}
static void layout_menu_overlay_toggle_cb(GtkAction *action, gpointer data)
mode = mode % 3 + 1;
GtkAction *radio = gtk_action_group_get_action(lw->action_group, "StereoAuto");
- radio_action_set_current_value(GTK_RADIO_ACTION(radio), mode);
+ gtk_radio_action_set_current_value(GTK_RADIO_ACTION(radio), mode);
/*
this is called via fallback in layout_menu_stereo_mode_cb
gint i = 0;
GList *ret = NULL;
- if (split[0] == NULL)
+ if (split[0] == NULL)
{
g_strfreev(split);
return NULL;
{
GList *path;
EditorDescription *editor = work->data;
- GtkActionEntry entry = { editor->key,
+ GtkActionEntry entry = { editor->key,
NULL,
editor->name,
- editor->hotkey,
+ editor->hotkey,
editor->comment ? editor->comment : editor->name,
G_CALLBACK(layout_menu_edit_cb) };
void layout_editors_reload_start(void)
{
- GList *work;
-
DEBUG_1("%s layout_editors_reload_start", get_exec_time());
if (layout_editors_reload_idle_id != -1)
string_list_free(layout_editors_desktop_files);
}
- work = layout_window_list;
-
editor_table_clear();
layout_editors_reload_idle_id = g_idle_add(layout_editors_reload_idle_cb, NULL);
}
void layout_toolbar_clear(LayoutWindow *lw, ToolbarType type)
{
- if (lw->toolbar_merge_id[type])
+ if (lw->toolbar_merge_id[type])
{
gtk_ui_manager_remove_ui(lw->ui_manager, lw->toolbar_merge_id[type]);
gtk_ui_manager_ensure_update(lw->ui_manager);
}
if (!gtk_action_group_get_action(lw->action_group_editors, action))
{
- GtkActionEntry entry = { action,
+ GtkActionEntry entry = { action,
GTK_STOCK_MISSING_IMAGE,
action,
- NULL,
+ NULL,
NULL,
NULL };
DEBUG_1("Creating temporary action %s", action);
gtk_action_group_add_actions(lw->action_group_editors, &entry, 1, lw);
}
}
- gtk_ui_manager_add_ui(lw->ui_manager, lw->toolbar_merge_id[type], path, action, action, GTK_UI_MANAGER_TOOLITEM, FALSE);
+ gtk_ui_manager_add_ui(lw->ui_manager, lw->toolbar_merge_id[type], path, action, action, GTK_UI_MANAGER_TOOLITEM, FALSE);
lw->toolbar_actions[type] = g_list_append(lw->toolbar_actions[type], g_strdup(action));
}
}
layout_toolbar_add(lw, type, action);
- g_free(action);
+ g_free(action);
}
/*
if (!lw->action_group) return;
action = gtk_action_group_get_action(lw->action_group, "FolderTree");
- radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->options.dir_view_type);
+ gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->options.dir_view_type);
action = gtk_action_group_get_action(lw->action_group, "SplitSingle");
- radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->split_mode);
+ gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->split_mode);
action = gtk_action_group_get_action(lw->action_group, "ViewIcons");
- radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->options.file_view_type);
+ gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->options.file_view_type);
action = gtk_action_group_get_action(lw->action_group, "FloatTools");
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.tools_float);
if (osd_flags & OSD_SHOW_HISTOGRAM)
{
action = gtk_action_group_get_action(lw->action_group, "HistogramChanR");
- radio_action_set_current_value(GTK_RADIO_ACTION(action), image_osd_histogram_get_channel(lw->image));
+ gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), image_osd_histogram_get_channel(lw->image));
action = gtk_action_group_get_action(lw->action_group, "HistogramModeLin");
- radio_action_set_current_value(GTK_RADIO_ACTION(action), image_osd_histogram_get_mode(lw->image));
+ gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), image_osd_histogram_get_mode(lw->image));
}
action = gtk_action_group_get_action(lw->action_group, "ConnectZoomMenu");
gtk_action_set_sensitive(action, lw->split_mode != SPLIT_NONE);
action = gtk_action_group_get_action(lw->action_group, "StereoAuto");
- radio_action_set_current_value(GTK_RADIO_ACTION(action), layout_image_stereo_pixbuf_get(lw));
+ gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), layout_image_stereo_pixbuf_get(lw));
layout_util_sync_color(lw);
}
static gboolean layout_bar_enabled(LayoutWindow *lw)
{
-#if GTK_CHECK_VERSION(2,20,0)
return lw->bar && gtk_widget_get_visible(lw->bar);
-#else
- return lw->bar && GTK_WIDGET_VISIBLE(lw->bar);
-#endif
}
static void layout_bar_destroyed(GtkWidget *widget, gpointer data)
LayoutWindow *lw = data;
lw->bar = NULL;
-/*
+/*
do not call layout_util_sync_views(lw) here
this is called either when whole layout is destroyed - no need for update
or when the bar is replaced - sync is called by upper function at the end of whole operation
// gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->bar, FALSE, FALSE, 0);
- gtk_paned_pack2(GTK_PANED(lw->utility_paned), lw->bar, FALSE, TRUE);
+ gtk_paned_pack2(GTK_PANED(lw->utility_paned), lw->bar, FALSE, TRUE);
bar_set_fd(lw->bar, layout_image_get_fd(lw));
}
static gboolean layout_bar_sort_enabled(LayoutWindow *lw)
{
-#if GTK_CHECK_VERSION(2,20,0)
return lw->bar_sort && gtk_widget_get_visible(lw->bar_sort);
-#else
- return lw->bar_sort && GTK_WIDGET_VISIBLE(lw->bar_sort);
-#endif
}
lw->bar_sort = NULL;
-/*
+/*
do not call layout_util_sync_views(lw) here
this is called either when whole layout is destroyed - no need for update
or when the bar is replaced - sync is called by upper function at the end of whole operation
lw->utility_paned = gtk_hpaned_new();
gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->utility_paned, TRUE, TRUE, 0);
- gtk_paned_pack1(GTK_PANED(lw->utility_paned), image, TRUE, FALSE);
+ gtk_paned_pack1(GTK_PANED(lw->utility_paned), image, TRUE, FALSE);
gtk_widget_show(lw->utility_paned);
gtk_widget_show(image);
void layout_exif_window_new(LayoutWindow *lw)
{
- if (lw->exif_window) return;
+ if (lw->exif_window) return;
lw->exif_window = advanced_exif_new();
if (!lw->exif_window) return;