示例#1
0
static void
href_cb(GtkObject *button)
{
	GtkWidget *href = g_object_get_data (G_OBJECT (button), "href");
	GtkWidget *url_ent = g_object_get_data (G_OBJECT (button), "url");
	GtkWidget *label_ent = g_object_get_data (G_OBJECT (button), "label");
	gchar *url, *text;

	url = gtk_editable_get_chars (GTK_EDITABLE(url_ent), 0, -1);
	text = gtk_editable_get_chars (GTK_EDITABLE(label_ent), 0, -1);
	if (!text || ! text[0])
		text = url;
	gnome_href_set_url(GNOME_HREF(href), url);
	gnome_href_set_text (GNOME_HREF(href), text);
}
示例#2
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_gnome_href_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gchar *url, *label_text;
  gboolean focus_on_click;

  url = gb_widget_input_string (data, HRefURL);
  if (data->apply)
    gnome_href_set_url (GNOME_HREF (widget), url && url[0] ? url : "");

  label_text = gb_widget_input_text (data, HRefLabel);
  /* Support the old name we used for the property. */
  if (!data->apply && data->action == GB_LOADING)
    label_text = gb_widget_input_text (data, "label");
  if (data->apply)
    gnome_href_set_text (GNOME_HREF (widget), label_text);
  if (data->action == GB_APPLYING)
    g_free (label_text);

  focus_on_click = gb_widget_input_bool (data, FocusOnClick);
  if (data->apply)
    gtk_button_set_focus_on_click (GTK_BUTTON (widget), focus_on_click);
}