Beispiel #1
0
/* "DiaZoomCombo" probably could work for both UI cases */
static void
integrated_ui_toolbar_zoom_combo_selection_changed (GtkComboBox *combo,
                                                    gpointer     user_data)
{
    /*
     * We call gtk_combo_get_get_active() so that typing in the combo entry
     * doesn't get handled as a selection change
     */
    if (gtk_combo_box_get_active (combo) != -1)
    {
        float zoom_percent;
        gchar * text;
#if GTK_CHECK_VERSION(2,24,0)
	text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT (combo));
#else
	text = gtk_combo_box_get_active_text (combo);
#endif
        if (sscanf (text, "%f", &zoom_percent) == 1)
        {
            view_zoom_set (zoom_percent * 10.0);
        }
        else if (g_ascii_strcasecmp (text, ZOOM_FIT) == 0)
        {
            view_show_all_callback (NULL);
        }

        g_free (text);
    }
}
Beispiel #2
0
Datei: menus.c Projekt: GNOME/dia
static void
integrated_ui_toolbar_zoom_activate (GtkWidget *item,
                                     gpointer   user_data)
{
    const gchar *text =  gtk_entry_get_text (GTK_ENTRY (item));
    float        zoom_percent;

    if (sscanf (text, "%f", &zoom_percent) == 1)
    {
        view_zoom_set (10.0 * zoom_percent);
    }
}