static void selection_changed_cb (EogThumbView *view, EogMapPlugin *plugin) { EogImage *image; ChamplainLabel *marker; if (!eog_thumb_view_get_n_selected (view)) return; image = eog_thumb_view_get_first_selected_image (view); g_return_if_fail (image != NULL); marker = g_object_get_data (G_OBJECT (image), "marker"); if (marker) { gdouble lat, lon; g_object_get (marker, "latitude", &lat, "longitude", &lon, NULL); champlain_view_center_on (CHAMPLAIN_VIEW (plugin->map), lat, lon); /* Reset the previous selection */ if (plugin->marker) update_marker_image (plugin->marker, GTK_ICON_SIZE_MENU); plugin->marker = marker; update_marker_image (plugin->marker, GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_widget_set_sensitive (plugin->jump_to_button, TRUE); } else { gtk_widget_set_sensitive (plugin->jump_to_button, FALSE); /* Reset the previous selection */ if (plugin->marker) update_marker_image (plugin->marker, GTK_ICON_SIZE_MENU); plugin->marker = NULL; } g_object_unref (image); }
static void eog_reload_plugin_update_action_state (EogReloadPlugin *plugin) { GAction *action; EogThumbView *thumbview; gboolean enable = FALSE; thumbview = EOG_THUMB_VIEW (eog_window_get_thumb_view (plugin->window)); if (G_LIKELY (thumbview)) { enable = (eog_thumb_view_get_n_selected (thumbview) != 0); } action = g_action_map_lookup_action (G_ACTION_MAP (plugin->window), EOG_RELOAD_PLUGIN_ACTION); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enable); }