static void
athena_location_entry_activate (GtkEntry *entry)
{
	AthenaLocationEntry *loc_entry;
	const gchar *entry_text;
	gchar *full_path, *uri_scheme = NULL;

	loc_entry = ATHENA_LOCATION_ENTRY (entry);
	entry_text = gtk_entry_get_text (entry);

	if (entry_text != NULL && *entry_text != '\0') {
		uri_scheme = g_uri_parse_scheme (entry_text);

		if (!g_path_is_absolute (entry_text) && uri_scheme == NULL && entry_text[0] != '~') {
			/* Fix non absolute paths */
			full_path = g_build_filename (loc_entry->details->current_directory, entry_text, NULL);
			gtk_entry_set_text (entry, full_path);
			g_free (full_path);
		}

		g_free (uri_scheme);
	}

	GTK_ENTRY_CLASS (athena_location_entry_parent_class)->activate (entry);
}
static void
gd_tagged_entry_class_init (GdTaggedEntryClass *klass)
{
    GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
    GtkEntryClass *eclass = GTK_ENTRY_CLASS (klass);
    GObjectClass *oclass = G_OBJECT_CLASS (klass);

    oclass->finalize = gd_tagged_entry_finalize;
    oclass->set_property = gd_tagged_entry_set_property;
    oclass->get_property = gd_tagged_entry_get_property;

    wclass->realize = gd_tagged_entry_realize;
    wclass->unrealize = gd_tagged_entry_unrealize;
    wclass->map = gd_tagged_entry_map;
    wclass->unmap = gd_tagged_entry_unmap;
    wclass->size_allocate = gd_tagged_entry_size_allocate;
    wclass->get_preferred_width = gd_tagged_entry_get_preferred_width;
    wclass->draw = gd_tagged_entry_draw;
    wclass->enter_notify_event = gd_tagged_entry_enter_notify;
    wclass->leave_notify_event = gd_tagged_entry_leave_notify;
    wclass->motion_notify_event = gd_tagged_entry_motion_notify;
    wclass->button_press_event = gd_tagged_entry_button_press_event;
    wclass->button_release_event = gd_tagged_entry_button_release_event;

    eclass->get_text_area_size = gd_tagged_entry_get_text_area_size;

    signals[SIGNAL_ACTION] =
        g_signal_new_class_handler ("action",
                                    GD_TYPE_TAGGED_ENTRY,
                                    G_SIGNAL_ACTION | G_SIGNAL_RUN_LAST,
                                    G_CALLBACK (gd_tagged_entry_action),
                                    NULL, NULL, NULL,
                                    G_TYPE_NONE,
                                    3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
    signals[SIGNAL_TAG_CLICKED] =
        g_signal_new ("tag-clicked",
                      GD_TYPE_TAGGED_ENTRY,
                      G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
                      0, NULL, NULL, NULL,
                      G_TYPE_NONE,
                      1, GD_TYPE_TAGGED_ENTRY_TAG);
    signals[SIGNAL_TAG_BUTTON_CLICKED] =
        g_signal_new ("tag-button-clicked",
                      GD_TYPE_TAGGED_ENTRY,
                      G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
                      0, NULL, NULL, NULL,
                      G_TYPE_NONE,
                      1, GD_TYPE_TAGGED_ENTRY_TAG);

    properties[PROP_TAG_BUTTON_VISIBLE] =
        g_param_spec_boolean ("tag-close-visible", "Tag close icon visibility",
                              "Whether the close button should be shown in tags.", TRUE,
                              G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);

    g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
static void
gd_tagged_entry_get_text_area_size (GtkEntry *entry,
                                    gint *x,
                                    gint *y,
                                    gint *width,
                                    gint *height)
{
    GdTaggedEntry *self = GD_TAGGED_ENTRY (entry);
    gint tag_panel_width;

    GTK_ENTRY_CLASS (gd_tagged_entry_parent_class)->get_text_area_size (entry, x, y, width, height);

    tag_panel_width = gd_tagged_entry_tag_panel_get_width (self);

    if (width)
        *width -= tag_panel_width;
}
示例#4
0
static void fm_path_entry_class_init(FmPathEntryClass *klass)
{
    GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
    GObjectClass* object_class = G_OBJECT_CLASS(klass);
    GtkEntryClass* entry_class = GTK_ENTRY_CLASS(klass);

    object_class->get_property = fm_path_entry_get_property;
    object_class->set_property = fm_path_entry_set_property;
    g_object_class_install_property( object_class,
                                    PROP_HIGHLIGHT_COMPLETION_MATCH,
                                    g_param_spec_boolean("highlight-completion-match",
                                                         "Highlight completion match",
                                                         "Wheather to highlight the completion match",
                                                         TRUE, G_PARAM_READWRITE) );
    object_class->finalize = fm_path_entry_finalize;
    entry_class->activate = fm_path_entry_activate;

    g_type_class_add_private( klass, sizeof (FmPathEntryPrivate) );
}
示例#5
0
static void
gtk_icon_entry_class_init (GtkIconEntryClass *klass)
{
  GObjectClass *gobject_class;
  GtkObjectClass *object_class;
  GtkWidgetClass *widget_class;
  GtkEntryClass *entry_class;

  parent_class = g_type_class_peek_parent(klass);

  gobject_class = G_OBJECT_CLASS(klass);
  object_class  = GTK_OBJECT_CLASS(klass);
  widget_class  = GTK_WIDGET_CLASS(klass);
  entry_class   = GTK_ENTRY_CLASS(klass);

  gobject_class->finalize = gtk_icon_entry_finalize;
  gobject_class->dispose = gtk_icon_entry_dispose;
  gobject_class->set_property = gtk_icon_entry_set_property;
  gobject_class->get_property = gtk_icon_entry_get_property;

  widget_class->map = gtk_icon_entry_map;
  widget_class->unmap = gtk_icon_entry_unmap;
  widget_class->realize = gtk_icon_entry_realize;
  widget_class->unrealize = gtk_icon_entry_unrealize;
  widget_class->size_request = gtk_icon_entry_size_request;
  widget_class->size_allocate = gtk_icon_entry_size_allocate;
  widget_class->expose_event = gtk_icon_entry_expose;
  widget_class->enter_notify_event = gtk_icon_entry_enter_notify;
  widget_class->leave_notify_event = gtk_icon_entry_leave_notify;
  widget_class->button_press_event = gtk_icon_entry_button_press;
  widget_class->button_release_event = gtk_icon_entry_button_release;
  widget_class->style_set = gtk_icon_entry_style_set;

  /**
   * GtkIconEntry::icon-pressed:
   * @entry: The entry on which the signal is emitted.
   * @icon_pos: The position of the clicked icon.
   * @button: The mouse button clicked.
   *
   * The ::icon-pressed signal is emitted when an icon is clicked.
   */
  signals[ICON_PRESSED] =
    g_signal_new ("icon_pressed",
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkIconEntryClass, icon_pressed),
		  NULL, NULL,
		  gtk_marshal_VOID__INT_INT,
		  G_TYPE_NONE, 2,
		  G_TYPE_INT,
		  G_TYPE_INT);

  /**
   * GtkIconEntry::icon-released:
   * @entry: The entry on which the signal is emitted.
   * @icon_pos: The position of the clicked icon.
   * @button: The mouse button clicked.
   *
   * The ::icon-released signal is emitted on the button release from a
   * mouse click.
   */
  signals[ICON_RELEASED] =
    g_signal_new ("icon_released",
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkIconEntryClass, icon_released),
		  NULL, NULL,
		  gtk_marshal_VOID__INT_INT,
		  G_TYPE_NONE, 2,
		  G_TYPE_INT,
		  G_TYPE_INT);

  /**
   * GtkIconEntry:pixbuf-primary:
   *
   * An image to use as the primary icon for the entry.
   */
  g_object_class_install_property (gobject_class,
				   PROP_PIXBUF_PRIMARY,
				   g_param_spec_object ("pixbuf-primary",
							P_("Primary pixbuf"),
							P_("Primary pixbuf for the entry"),
							GDK_TYPE_PIXBUF,
							GTK_PARAM_READWRITE));

  /**
   * GtkIconEntry:pixbuf-secondary:
   *
   * An image to use as the secondary icon for the entry.
   */
  g_object_class_install_property (gobject_class,
				   PROP_PIXBUF_SECONDARY,
				   g_param_spec_object ("pixbuf-secondary",
							P_("Secondary pixbuf"),
							P_("Secondary pixbuf for the entry"),
							GDK_TYPE_PIXBUF,
							GTK_PARAM_READWRITE));

  g_object_class_install_property (gobject_class,
				   PROP_STOCK_PRIMARY,
				   g_param_spec_string ("stock-primary",
							P_("Primary stock ID"),
							P_("Stock ID for primary icon"),
							NULL,
							GTK_PARAM_WRITABLE));

  g_object_class_install_property (gobject_class,
				   PROP_STOCK_SECONDARY,
				   g_param_spec_string ("stock-secondary",
							P_("Secondary stock ID"),
							P_("Stock ID for secondary icon"),
							NULL,
							GTK_PARAM_WRITABLE));

  g_object_class_install_property (gobject_class,
				   PROP_ICON_NAME_PRIMARY,
				   g_param_spec_string ("icon-name-primary",
							P_("Primary icon name"),
							P_("Icon name for primary icon"),
							NULL,
							GTK_PARAM_WRITABLE));

  g_object_class_install_property (gobject_class,
				   PROP_ICON_NAME_SECONDARY,
				   g_param_spec_string ("icon-name-secondary",
							P_("Secondary icon name"),
							P_("Icon name for secondary icon"),
							NULL,
							GTK_PARAM_WRITABLE));

  #if GLIB_CHECK_VERSION (2, 16, 0)
  g_object_class_install_property (gobject_class,
				   PROP_GICON_PRIMARY,
				   g_param_spec_object ("gicon-primary",
							P_("Primary GIcon"),
							P_("GIcon for primary icon"),
							G_TYPE_ICON,
							GTK_PARAM_READWRITE));

  g_object_class_install_property (gobject_class,
				   PROP_GICON_SECONDARY,
				   g_param_spec_object ("gicon-secondary",
							P_("Secondary GIcon"),
							P_("GIcon for secondary icon"),
							G_TYPE_ICON,
							GTK_PARAM_READWRITE));
  #endif

  g_type_class_add_private (klass, sizeof (GtkIconEntryPrivate));
}
示例#6
0
static void
sexy_icon_entry_class_init(SexyIconEntryClass *klass)
{
	GObjectClass *gobject_class;
	GtkObjectClass *object_class;
	GtkWidgetClass *widget_class;
	GtkEntryClass *entry_class;

	parent_class = g_type_class_peek_parent(klass);

	gobject_class = G_OBJECT_CLASS(klass);
	object_class  = GTK_OBJECT_CLASS(klass);
	widget_class  = GTK_WIDGET_CLASS(klass);
	entry_class   = GTK_ENTRY_CLASS(klass);

	gobject_class->finalize = sexy_icon_entry_finalize;

	object_class->destroy = sexy_icon_entry_destroy;

	widget_class->map = sexy_icon_entry_map;
	widget_class->unmap = sexy_icon_entry_unmap;
	widget_class->realize = sexy_icon_entry_realize;
	widget_class->unrealize = sexy_icon_entry_unrealize;
	widget_class->size_request = sexy_icon_entry_size_request;
	widget_class->size_allocate = sexy_icon_entry_size_allocate;
	widget_class->expose_event = sexy_icon_entry_expose;
	widget_class->enter_notify_event = sexy_icon_entry_enter_notify;
	widget_class->leave_notify_event = sexy_icon_entry_leave_notify;
	widget_class->button_press_event = sexy_icon_entry_button_press;
	widget_class->button_release_event = sexy_icon_entry_button_release;

	/**
	 * SexyIconEntry::icon-pressed:
	 * @entry: The entry on which the signal is emitted.
	 * @icon_pos: The position of the clicked icon.
	 * @button: The mouse button clicked.
	 *
	 * The ::icon-pressed signal is emitted when an icon is clicked.
	 */
	signals[ICON_PRESSED] =
		g_signal_new("icon_pressed",
					 G_TYPE_FROM_CLASS(gobject_class),
					 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
					 G_STRUCT_OFFSET(SexyIconEntryClass, icon_pressed),
					 NULL, NULL,
					 gtk_marshal_VOID__INT_INT,
					 G_TYPE_NONE, 2,
					 G_TYPE_INT,
					 G_TYPE_INT);

	/**
	 * SexyIconEntry::icon-released:
	 * @entry: The entry on which the signal is emitted.
	 * @icon_pos: The position of the clicked icon.
	 * @button: The mouse button clicked.
	 *
	 * The ::icon-released signal is emitted on the button release from a
	 * mouse click.
	 */
	signals[ICON_RELEASED] =
		g_signal_new("icon_released",
					 G_TYPE_FROM_CLASS(gobject_class),
					 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
					 G_STRUCT_OFFSET(SexyIconEntryClass, icon_released),
					 NULL, NULL,
					 gtk_marshal_VOID__INT_INT,
					 G_TYPE_NONE, 2,
					 G_TYPE_INT,
					 G_TYPE_INT);
}
示例#7
0
static void  fm_path_entry_activate(GtkEntry *entry)
{
    /* Chain up so that entry->activates_default is honored */
    GTK_ENTRY_CLASS(fm_path_entry_parent_class)->activate(entry);
}