g_object_set (object, property, file, NULL);
}
+static gchar*
+proxy_combo_box_text_changed_cb (GtkComboBox* button, GObject* object)
+{
+ gchar* text = gtk_combo_box_get_active_text (button);
+ const gchar* property = g_object_get_data (G_OBJECT (button), "property");
+ g_object_set (object, property, text, NULL);
+ return FALSE;
+}
+
static gboolean
proxy_entry_focus_out_event_cb (GtkEntry* entry,
GdkEventFocus* event,
static gboolean
proxy_spin_button_changed_cb (GtkSpinButton* button, GObject* object)
{
- gdouble value = gtk_spin_button_get_value (button);
+ gint value = gtk_spin_button_get_value_as_int (button);
const gchar* property = g_object_get_data (G_OBJECT (button), "property");
g_object_set (object, property, value, NULL);
return FALSE;
* choosing an existing folder.
* "uri": the widget created will be particularly suitable for
* choosing an existing filename, encoded as an URI.
+ * "font": the widget created will be particularly suitable for
+ * choosing a font from installed fonts.
*
* Any other values for @hint are silently ignored.
*
g_signal_connect (widget, "file-set",
G_CALLBACK (proxy_uri_file_set_cb), object);
}
+ else if (type == G_TYPE_PARAM_STRING && _hint == g_intern_string ("font"))
+ {
+ widget = gtk_combo_box_new_text ();
+ PangoContext* context = gtk_widget_get_pango_context (widget);
+ PangoFontFamily** families;
+ int n_families;
+ pango_context_list_families (context, &families, &n_families);
+ g_object_get (object, property, &string, NULL);
+ gint i = 0;
+ while (i < n_families)
+ {
+ const gchar* font = pango_font_family_get_name (families[i]);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), font);
+ if (string && !strcmp (font, string))
+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i);
+ i++;
+ }
+ g_signal_connect (widget, "changed",
+ G_CALLBACK (proxy_combo_box_text_changed_cb), object);
+ g_free (families);
+ }
else if (type == G_TYPE_PARAM_STRING)
{
widget = gtk_entry_new ();
widget = gtk_spin_button_new_with_range (
G_PARAM_SPEC_INT (pspec)->minimum,
G_PARAM_SPEC_INT (pspec)->maximum, 1);
- gdouble value;
+ gint value;
g_object_get (object, property, &value, NULL);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
g_signal_connect (widget, "changed",
{ STOCK_TAB_NEW, N_("New _Tab"), 0, 0, NULL },
{ STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, NULL },
#if !GTK_CHECK_VERSION(2, 10, 0)
- { GTK_STOCK_SELECT_ALL, N_("Select _All", 0, 0, NULL },
+ { GTK_STOCK_SELECT_ALL, N_("Select _All"), 0, 0, NULL },
#endif
#if !GTK_CHECK_VERSION(2, 8, 0)
{ GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), 0, 0, NULL },
label = katze_property_label (settings, "default-font-family");
INDENTED_ADD (label, 0, 1, 0, 1);
hbox = gtk_hbox_new (FALSE, 4);
- button = katze_property_proxy (settings, "default-font-family", NULL);
+ button = katze_property_proxy (settings, "default-font-family", "font");
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
entry = katze_property_proxy (settings, "default-font-size", NULL);
gtk_box_pack_end (GTK_BOX (hbox), entry, FALSE, FALSE, 4);