Ejemplo n.º 1
0
static void
custom_command_entry_changed_cb (GtkEntry *entry)
{
	const char *command;
	GError *error = NULL;

	command = gtk_entry_get_text (entry);

	if (g_shell_parse_argv (command, NULL, NULL, &error))
	{
		gtk_entry_set_icon_from_stock (entry, GTK_PACK_END, NULL);
	}
	else
	{
		char *tooltip;

		gtk_entry_set_icon_from_stock (entry, GTK_PACK_END, GTK_STOCK_DIALOG_WARNING);

		tooltip = g_strdup_printf (_("Error parsing command: %s"), error->message);
		gtk_entry_set_icon_tooltip_text (entry, GTK_PACK_END, tooltip);
		g_free (tooltip);

		g_error_free (error);
	}
}
Ejemplo n.º 2
0
static void remmina_main_create_quick_search(RemminaMain *remminamain)
{
	GtkWidget *widget;
	GValue val =
	{ 0 };

	remminamain->priv->quick_search_separator = gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(remminamain->priv->toolbar), remminamain->priv->quick_search_separator, -1);

	remminamain->priv->quick_search_item = gtk_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(remminamain->priv->toolbar), remminamain->priv->quick_search_item, -1);

	widget = gtk_entry_new();
	gtk_widget_show(widget);
	gtk_entry_set_icon_from_stock(GTK_ENTRY(widget), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
	gtk_entry_set_icon_from_stock(GTK_ENTRY(widget), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
	gtk_entry_set_width_chars(GTK_ENTRY(widget), 25);
	gtk_container_add(GTK_CONTAINER(remminamain->priv->quick_search_item), widget);

	g_value_init(&val, G_TYPE_BOOLEAN);
	g_value_set_boolean(&val, FALSE);
	g_object_set_property(G_OBJECT(widget), "primary-icon-activatable", &val);
	g_value_unset(&val);

	g_signal_connect(G_OBJECT(widget), "icon-press", G_CALLBACK(remmina_main_quick_search_on_icon_press), remminamain);
	g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(remmina_main_quick_search_on_changed), remminamain);

	remminamain->priv->quick_search_entry = widget;
}
Ejemplo n.º 3
0
static void facq_plug_dialog_constructed(GObject *self)
{
	FacqPlugDialog *dialog = FACQ_PLUG_DIALOG(self);
	GtkWidget *vbox = NULL, *table = NULL, *widget = NULL;

	dialog->priv->dialog = 
		gtk_dialog_new_with_buttons("Plug preferences",
				GTK_WINDOW(dialog->priv->top_window),
					GTK_DIALOG_MODAL | 
						GTK_DIALOG_DESTROY_WITH_PARENT,
							GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,
								GTK_STOCK_OK,GTK_RESPONSE_OK,NULL);

	vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog->priv->dialog));
	table = gtk_table_new(2,2,FALSE);
	
	widget = gtk_label_new("Address:");
	gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT);
	gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,0,1);
	
	widget = gtk_entry_new();
	if(dialog->priv->address)
		gtk_entry_set_text(GTK_ENTRY(widget),dialog->priv->address);
	else
		gtk_entry_set_text(GTK_ENTRY(widget),"all");
	gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,GTK_STOCK_CLEAR);
	gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,GTK_STOCK_NETWORK);
	gtk_entry_set_icon_activatable(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,TRUE);
	gtk_entry_set_icon_activatable(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,TRUE);
	gtk_entry_set_icon_sensitive(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,TRUE);
	gtk_entry_set_icon_sensitive(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,TRUE);
	g_signal_connect(widget,"icon-press",
				G_CALLBACK(address_icons_callback),dialog);
	dialog->priv->address_entry = widget;
	gtk_table_attach_defaults(GTK_TABLE(table),widget,1,2,0,1);

	widget = gtk_label_new("Port:");
	gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT);
	gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,1,2);
	
	widget = gtk_spin_button_new_with_range(0,65535,1);
	gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,GTK_STOCK_CLEAR);
	gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_SECONDARY,GTK_STOCK_CONNECT);
	gtk_spin_button_set_increments(GTK_SPIN_BUTTON(widget),1,10);
	gtk_spin_button_set_digits(GTK_SPIN_BUTTON(widget),0);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),dialog->priv->port);
	g_signal_connect(GTK_ENTRY(widget),"icon-press",
				G_CALLBACK(port_icons_callback),dialog);
	dialog->priv->spin_button = widget;
	gtk_table_attach_defaults(GTK_TABLE(table),widget,1,2,1,2);

	gtk_widget_show_all(table);

	gtk_container_add(GTK_CONTAINER(vbox),table);
}
Ejemplo n.º 4
0
/**
 * gdaui_bar_add_search_entry:
 * @bar: a #GdauiBar
 *
 * Returns: (transfer none): the created #GtkEntry
 */
GtkWidget *
gdaui_bar_add_search_entry (GdauiBar *bar)
{
	g_return_val_if_fail (GDAUI_IS_BAR (bar), NULL);

	GtkWidget *vb, *entry;

	vb = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (vb), GTK_BUTTONBOX_CENTER);
	gtk_box_pack_start (GTK_BOX (bar->priv->action_area), vb, FALSE, FALSE, 0);

	entry = gtk_entry_new ();
	gtk_box_pack_start (GTK_BOX (vb), entry, FALSE, FALSE, 0);

	/* CSS theming */
	GtkStyleContext *context;
	context = gtk_widget_get_style_context (vb);
	gtk_style_context_add_provider (context, css_provider, G_MAXUINT);
	gtk_style_context_add_class (context, "gdauibar_entry");

	context = gtk_widget_get_style_context (entry);
	gtk_style_context_add_provider (context, css_provider, G_MAXUINT);
	gtk_style_context_add_class (context, "gdauibar_entry");

	gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
				       GTK_ENTRY_ICON_SECONDARY,
				       GTK_STOCK_CLEAR);
	g_signal_connect (entry, "icon-press",
			  G_CALLBACK (find_icon_pressed_cb), NULL);

	gtk_widget_show_all (vb);
	return entry;
}
Ejemplo n.º 5
0
static GtkWidget *
make_xpath_entry (XpathExplorer *ttt)
{
	GtkEntry *entry;
	
	entry = gtk_entry_new ();

	gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
                                   GTK_ENTRY_ICON_SECONDARY,
                                   GTK_STOCK_CLEAR);

	gtk_widget_set_tooltip_text(entry, _("Enter an Xpath"));

	g_signal_connect (entry, "icon-press",
                      G_CALLBACK (xpath_icon_press_cb), ttt);
    g_signal_connect (entry, "activate",
                      G_CALLBACK (xpath_activate_cb), ttt);

    g_signal_connect (entry, "delete-text",
                      G_CALLBACK (xpath_delete_text_handler), ttt);

	g_signal_connect(G_OBJECT(entry), "insert-text",
					 G_CALLBACK(xpath_insert_text_handler), ttt);

	return entry;
}
Ejemplo n.º 6
0
static void
open_cb (GtkWidget * w, gpointer d)
{
    GtkWidget *dlg, *cnt, *lbl, *entry;

    dlg = gtk_dialog_new_with_buttons (_("Open URI"),
                                       GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))),
                                       GTK_DIALOG_DESTROY_WITH_PARENT,
                                       GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
    gtk_window_set_default_size (GTK_WINDOW (dlg), 350, -1);

    cnt = gtk_dialog_get_content_area (GTK_DIALOG (dlg));

    lbl = gtk_label_new (_("Enter URI or file name:"));
    gtk_misc_set_alignment (GTK_MISC (lbl), 0, 0);
    gtk_widget_show (lbl);
    gtk_box_pack_start (GTK_BOX (cnt), lbl, TRUE, FALSE, 2);

    entry = gtk_entry_new ();
    gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, "gtk-directory");
    gtk_widget_show (entry);
    gtk_box_pack_start (GTK_BOX (cnt), entry, TRUE, FALSE, 2);

    g_signal_connect (G_OBJECT (entry), "icon-press", G_CALLBACK (select_file_cb), NULL);
    g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (do_open_cb), dlg);

    if (gtk_dialog_run (GTK_DIALOG (dlg)) == GTK_RESPONSE_ACCEPT)
        load_uri (gtk_entry_get_text (GTK_ENTRY (entry)));

    gtk_widget_destroy (dlg);
}
Ejemplo n.º 7
0
/*
static gboolean browserWindowCanZoomIn(BrowserWindow *window)
{
    gdouble zoomLevel = webkit_web_view_get_zoom_level(window->webView) * zoomStep;
    return zoomLevel < maximumZoomLevel;
}

static gboolean browserWindowCanZoomOut(BrowserWindow *window)
{
    gdouble zoomLevel = webkit_web_view_get_zoom_level(window->webView) / zoomStep;
    return zoomLevel > minimumZoomLevel;
}

static void browserWindowUpdateZoomActions(BrowserWindow *window)
{
    gtk_widget_set_sensitive(window->zoomInItem, browserWindowCanZoomIn(window));
    gtk_widget_set_sensitive(window->zoomOutItem, browserWindowCanZoomOut(window));
}

static void webViewZoomLevelChanged(GObject *object, GParamSpec *paramSpec, BrowserWindow *window)
{
    browserWindowUpdateZoomActions(window);
}
*/
static void updateUriEntryIcon(BrowserWindow *window)
{
    GtkEntry *entry = GTK_ENTRY(window->uriEntry);
    if (window->favicon)
        gtk_entry_set_icon_from_pixbuf(entry, GTK_ENTRY_ICON_PRIMARY, window->favicon);
    else
        gtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_NEW);
}
Ejemplo n.º 8
0
GtkWidget* pragha_search_entry_new(PraghaPreferences *preferences)
{
	GtkWidget *search_entry;

	search_entry = gtk_entry_new ();

	gtk_entry_set_icon_from_stock (GTK_ENTRY(search_entry), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
	gtk_entry_set_icon_from_stock (GTK_ENTRY(search_entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);

	gtk_entry_set_icon_sensitive (GTK_ENTRY(search_entry), GTK_ENTRY_ICON_SECONDARY, FALSE);

	/* Signal handlers */

	g_signal_connect (G_OBJECT(search_entry), "icon-press",
			G_CALLBACK (pragha_search_bar_icon_pressed_cb), preferences);

	return search_entry;
}
Ejemplo n.º 9
0
/**
 * Create a spinbutton with an icon to clear the entry
 *
 * Ideal for entries used for getting user entered transitory data,
 *  so it is easy to delete the number and start again.
 */
GtkWidget *ui_spin_button_new ( GtkAdjustment *adjustment,
                                gdouble climb_rate,
                                guint digits )
{
	GtkWidget *spin = gtk_spin_button_new ( adjustment, climb_rate, digits );
	gtk_entry_set_icon_from_stock ( GTK_ENTRY(spin), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_CLEAR );
	g_signal_connect ( spin, "icon-release", G_CALLBACK(ui_icon_clear_entry), GINT_TO_POINTER(GTK_ENTRY_ICON_PRIMARY) );
	return spin;
}
Ejemplo n.º 10
0
static void
search_by_description (GtkWidget *item,
                       GtkEntry  *entry)
{
  gtk_entry_set_icon_from_stock (entry,
                                 GTK_ENTRY_ICON_PRIMARY,
                                 GTK_STOCK_EDIT);
  gtk_entry_set_icon_tooltip_text (entry,
                                   GTK_ENTRY_ICON_PRIMARY,
                                   "Search by description\n"
                                   "Click here to change the search type");
}
Ejemplo n.º 11
0
static void
search_by_file (GtkWidget *item,
                GtkEntry  *entry)
{
  gtk_entry_set_icon_from_stock (entry,
                                 GTK_ENTRY_ICON_PRIMARY,
                                 GTK_STOCK_OPEN);
  gtk_entry_set_icon_tooltip_text (entry,
                                   GTK_ENTRY_ICON_PRIMARY,
                                   "Search by file name\n"
                                   "Click here to change the search type");
}
Ejemplo n.º 12
0
/**
 * Create an entry field with an icon to clear the entry
 *
 * Ideal for entries used for getting user entered transitory data,
 *  so it is easy to delete the text and start again.
 */
GtkWidget *ui_entry_new ( const gchar *str, GtkEntryIconPosition position )
{
	GtkWidget *entry = gtk_entry_new();
	if ( str )
		gtk_entry_set_text ( GTK_ENTRY(entry), str );
	gtk_entry_set_icon_from_stock ( GTK_ENTRY(entry), position, GTK_STOCK_CLEAR );
#if GTK_CHECK_VERSION (2,20,0)
	text_changed_cb ( GTK_ENTRY(entry), NULL, GINT_TO_POINTER(position) );
	g_signal_connect ( entry, "notify::text", G_CALLBACK(text_changed_cb), GINT_TO_POINTER(position) );
#endif
	g_signal_connect ( entry, "icon-release", G_CALLBACK(ui_icon_clear_entry), GINT_TO_POINTER(position) );
	return entry;
}
Ejemplo n.º 13
0
/*
 * Create the dialog of 'Go To Line'
 */
void av_dialog_goto_line_new(const av_doc *doc)
{
  GtkWidget *entry = NULL;
  const char *entry_text = NULL;
  guint line = 0;
  gboolean status = FALSE;
  gint result = 0;

  /*
   * Create dialog
   */
  main_widget.dialog_goto_line = gtk_dialog_new();

  gtk_window_set_decorated(GTK_WINDOW(main_widget.dialog_goto_line), FALSE);
  gtk_window_set_resizable(GTK_WINDOW(main_widget.dialog_goto_line), FALSE);
  gtk_window_set_opacity(GTK_WINDOW(main_widget.dialog_goto_line), AV_WIDGET_GOTO_LINE_DIALOG_OPACITY);
  gtk_window_set_position(GTK_WINDOW(main_widget.dialog_goto_line), GTK_WIN_POS_CENTER);

  /*
   * Create entry in dialog
   */
  entry = gtk_entry_new();
  gtk_widget_show(entry);

  gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_GO_FORWARD);
  gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE);
  gtk_entry_set_width_chars(GTK_ENTRY(entry), AV_WIDGET_GOTO_LINE_DIALOG_ENTRY_WIDTH);

  gtk_dialog_add_action_widget(GTK_DIALOG(main_widget.dialog_goto_line),
                               entry,
                               GTK_RESPONSE_OK);

  result = gtk_dialog_run(GTK_DIALOG(main_widget.dialog_goto_line));
  switch (result)
  {
    case GTK_RESPONSE_CANCEL:
      AV_DBG("%s: canceled\n", __func__);
      break;
    case GTK_RESPONSE_OK:
      entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
      AV_DBG("%s: goto line: %s\n", __func__, entry_text);
      status = dialog_entry_text_to_digit(entry_text, &line);
      if (status == TRUE) av_editor_goto_line(&doc->editor, line);
      break;
    default:
      break;
  }

  gtk_widget_destroy(entry);
  gtk_widget_destroy(main_widget.dialog_goto_line);
}
Ejemplo n.º 14
0
/*
 * Create the dialog of 'Search'
 */
void av_dialog_search_new(const av_doc *doc)
{
  GtkWidget *entry = NULL;
  const char *entry_text = NULL;
  gint result = 0;

  /*
   * Create dialog
   */
  main_widget.dialog_search = gtk_dialog_new();

  gtk_window_set_decorated(GTK_WINDOW(main_widget.dialog_search), FALSE);
  gtk_window_set_resizable(GTK_WINDOW(main_widget.dialog_search), FALSE);
  gtk_window_set_opacity(GTK_WINDOW(main_widget.dialog_search), AV_WIDGET_SEARCH_DIALOG_OPACITY);
  gtk_window_set_position(GTK_WINDOW(main_widget.dialog_search), GTK_WIN_POS_CENTER_ALWAYS);

  /*
   * Create entry in dialog
   */
  entry = gtk_entry_new();
  gtk_widget_show(entry);

  gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_GO_FORWARD);
  gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE);
  gtk_entry_set_width_chars(GTK_ENTRY(entry), AV_WIDGET_SEARCH_DIALOG_ENTRY_WIDTH);

  gtk_dialog_add_action_widget(GTK_DIALOG(main_widget.dialog_search),
                               entry,
                               GTK_RESPONSE_OK);

  /* Create completion in entry */
  dialog_entry_completion_new(GTK_WIDGET(entry), dialog_search_entry_completion_cb, (gpointer)doc);

  result = gtk_dialog_run(GTK_DIALOG(main_widget.dialog_search));
  switch (result)
  {
    case GTK_RESPONSE_CANCEL:
      AV_DBG("%s: canceled\n", __func__);
      break;
    case GTK_RESPONSE_OK:
      entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
      AV_DBG("%s: search text: %s\n", __func__, entry_text);
      av_editor_search(&doc->editor, entry_text);
      break;
    default:
      break;
  }

  gtk_widget_destroy(entry);
  gtk_widget_destroy(main_widget.dialog_search);
}
Ejemplo n.º 15
0
static void
presence_chooser_set_status_editing (EmpathyPresenceChooser *self,
                                     gboolean editing)
{
	EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
	GtkWidget *entry;

	if (priv->block_set_editing) {
		return;
	}

	entry = gtk_bin_get_child (GTK_BIN (self));
	if (editing) {
		priv->editing_status = TRUE;

		gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
					       GTK_ENTRY_ICON_SECONDARY,
					       GTK_STOCK_OK);
		gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
						 GTK_ENTRY_ICON_SECONDARY,
						 _("Set status"));
		gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
					      GTK_ENTRY_ICON_PRIMARY,
					      FALSE);
	} else {
		GtkWidget *window;

		presence_chooser_set_favorite_icon (self);
		gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
					      GTK_ENTRY_ICON_PRIMARY,
					      TRUE);

		/* attempt to get the toplevel for this widget */
		window = gtk_widget_get_toplevel (GTK_WIDGET (self));
		if (GTK_WIDGET_TOPLEVEL (window) && GTK_IS_WINDOW (window)) {
			/* unset the focus */
			gtk_window_set_focus (GTK_WINDOW (window), NULL);
		}

		/* see presence_chooser_entry_focus_out_cb ()
		 * for what this does */
		if (priv->focus_out_idle_source != 0) {
			g_source_remove (priv->focus_out_idle_source);
			priv->focus_out_idle_source = 0;
		}

		gtk_editable_set_position (GTK_EDITABLE (entry), 0);

		priv->editing_status = FALSE;
	}
}
Ejemplo n.º 16
0
static GtkWidget *
glade_eprop_accel_create_input (GladeEditorProperty * eprop)
{
  GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop);

  eprop_accel->entry = gtk_entry_new ();
  gtk_widget_set_valign (eprop_accel->entry, GTK_ALIGN_CENTER);
  gtk_editable_set_editable (GTK_EDITABLE (eprop_accel->entry), FALSE);
  gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_accel->entry), 
                                 GTK_ENTRY_ICON_SECONDARY,
                                 GTK_STOCK_EDIT);
  g_signal_connect_swapped (eprop_accel->entry, "icon-release",
                            G_CALLBACK (glade_eprop_accel_show_dialog), eprop);

  return eprop_accel->entry;
}
Ejemplo n.º 17
0
void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id)
{
#if GTK_CHECK_VERSION(2,16,0)
	gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), icon_pos, stock_id);
#else
	GtkImage *image = GTK_IMAGE(gtk_image_new_from_stock(stock_id, 
					GTK_ICON_SIZE_LARGE_TOOLBAR));

	if (image != NULL) {
		sexy_icon_entry_set_icon(SEXY_ICON_ENTRY(entry),
					 (SexyIconEntryPosition)icon_pos,
					 image);
		g_object_unref(image);
	}

#endif
}
Ejemplo n.º 18
0
void
set_entry_validation_error (GtkEntry    *entry,
                            const gchar *text)
{
        g_object_set (entry, "caps-lock-warning", FALSE, NULL);
        gtk_entry_set_icon_from_stock (entry,
                                       GTK_ENTRY_ICON_SECONDARY,
                                       GTK_STOCK_DIALOG_ERROR);
        gtk_entry_set_icon_activatable (entry,
                                        GTK_ENTRY_ICON_SECONDARY,
                                        TRUE);
        g_signal_connect (entry, "icon-release",
                          G_CALLBACK (icon_released), FALSE);
        g_signal_connect (entry, "query-tooltip",
                          G_CALLBACK (query_tooltip), NULL);
        g_object_set (entry, "has-tooltip", TRUE, NULL);
        gtk_entry_set_icon_tooltip_text (entry,
                                         GTK_ENTRY_ICON_SECONDARY,
                                         text);
}
Ejemplo n.º 19
0
static void
gimp_action_editor_init (GimpActionEditor *editor)
{
  GtkWidget *hbox;
  GtkWidget *label;
  GtkWidget *entry;

  gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
                                  GTK_ORIENTATION_VERTICAL);

  gtk_box_set_spacing (GTK_BOX (editor), 12);

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
  gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  label = gtk_label_new_with_mnemonic (_("_Search:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  entry = gtk_entry_new ();
  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
  gtk_widget_show (entry);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);

  gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
                                 GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
  gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
                                  GTK_ENTRY_ICON_SECONDARY, TRUE);
  gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
                                GTK_ENTRY_ICON_SECONDARY, FALSE);

  g_signal_connect (entry, "icon-press",
                    G_CALLBACK (gimp_action_editor_filter_clear),
                    NULL);
  g_signal_connect (entry, "changed",
                    G_CALLBACK (gimp_action_editor_filter_changed),
                    editor);
}
Ejemplo n.º 20
0
void gtkhash_properties_list_check_digests(struct page_s *page)
{
	const char *str_in = gtk_entry_get_text(page->entry_check);
	const char *icon = NULL;

	if (*str_in) {
		for (int i = 0; i < HASH_FUNCS_N; i++) {
			if (!page->hash_file.funcs[i].enabled)
				continue;

			const char *str_out = gtkhash_hash_func_get_digest(
				&page->hash_file.funcs[i], DIGEST_FORMAT_HEX_LOWER);
			if (strcasecmp(str_in, str_out) == 0) {
				icon = GTK_STOCK_YES;
				break;
			}
		}
	}

	gtk_entry_set_icon_from_stock(page->entry_check, GTK_ENTRY_ICON_SECONDARY,
		icon);
}
Ejemplo n.º 21
0
static void
presence_chooser_set_favorite_icon (EmpathyPresenceChooser *self)
{
	GtkWidget *entry;
	PresenceChooserEntryType type;

	entry = gtk_bin_get_child (GTK_BIN (self));
	type = presence_chooser_get_entry_type (self);

	if (type == ENTRY_TYPE_CUSTOM || type == ENTRY_TYPE_SAVED) {
		if (presence_chooser_is_preset (self)) {
			/* saved entries can be removed from the list */
			gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
				           GTK_ENTRY_ICON_SECONDARY,
					   "empathy-starred");
			gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
					 GTK_ENTRY_ICON_SECONDARY,
					 _("Click to remove this status as a favorite"));
		}
		else {
			/* custom entries can be favorited */
			gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
				           GTK_ENTRY_ICON_SECONDARY,
					   "empathy-unstarred");
			gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
					 GTK_ENTRY_ICON_SECONDARY,
					 _("Click to make this status a favorite"));
		}
	}
	else {
		/* built-in entries cannot be favorited */
		gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
				           GTK_ENTRY_ICON_SECONDARY,
					   NULL);
		gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
					 GTK_ENTRY_ICON_SECONDARY,
					 NULL);
	}
}
Ejemplo n.º 22
0
static void facq_baf_view_dialog_constructed(GObject *self)
{
	FacqBAFViewDialog *dialog = FACQ_BAF_VIEW_DIALOG(self);
	GtkWidget *vbox = NULL, *table = NULL, *widget = NULL;

	dialog->priv->dialog = 
		gtk_dialog_new_with_buttons(_("Page preferences"),
				GTK_WINDOW(dialog->priv->top_window),
					GTK_DIALOG_MODAL | 
						GTK_DIALOG_DESTROY_WITH_PARENT,
							GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,
								GTK_STOCK_OK,GTK_RESPONSE_OK,NULL);

	vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog->priv->dialog));
	table = gtk_table_new(1,3,FALSE);
	
	widget = gtk_label_new(_("Time per page:"));
	gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT);
	gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,0,1);
	
	widget = gtk_spin_button_new_with_range(5,86400,1);
	gtk_entry_set_icon_from_stock(GTK_ENTRY(widget),GTK_ENTRY_ICON_PRIMARY,GTK_STOCK_CLEAR);
	gtk_spin_button_set_increments(GTK_SPIN_BUTTON(widget),1,10);
	gtk_spin_button_set_digits(GTK_SPIN_BUTTON(widget),0);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),10);
	g_signal_connect(GTK_ENTRY(widget),"icon-press",
				G_CALLBACK(clear_icon_callback),dialog);
	dialog->priv->spin_button = widget;
	gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,1,2);

	widget = gtk_label_new(_(" seconds"));
	gtk_label_set_justify(GTK_LABEL(widget),GTK_JUSTIFY_LEFT);
	gtk_table_attach_defaults(GTK_TABLE(table),widget,0,1,2,3);

	gtk_widget_show_all(table);

	gtk_container_add(GTK_CONTAINER(vbox),table);
}
Ejemplo n.º 23
0
static void search_entry_changed_cb (GtkEditable *editable, YGtkHelpDialog *dialog)
{
	static GdkColor red = { 0, 255 << 8, 102 << 8, 102 << 8 };
	static GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
	static GdkColor yellow = { 0, 0xf7f7, 0xf7f7, 0xbdbd };
	static GdkColor black = { 0, 0, 0, 0 };

	GtkWidget *widget = GTK_WIDGET (editable);
	GtkEntry *entry = GTK_ENTRY (editable);
	const gchar *text = gtk_entry_get_text (entry);
	gboolean found = ygtk_html_wrap_search (dialog->help_text, text);

	if (found && *text) {
		gtk_widget_modify_base (widget, GTK_STATE_NORMAL, &yellow);
		gtk_widget_modify_text (widget, GTK_STATE_NORMAL, &black);
	}
	else if (found) {  // revert
		gtk_widget_modify_base (widget, GTK_STATE_NORMAL, NULL);
		gtk_widget_modify_text (widget, GTK_STATE_NORMAL, NULL);
	}
	else {
		gtk_widget_modify_base (widget, GTK_STATE_NORMAL, &red);
		gtk_widget_modify_text (widget, GTK_STATE_NORMAL, &white);
		gtk_widget_error_bell (widget);
	}

	gboolean showIcon = *text;  // show clear icon if text
	if (showIcon != gtk_entry_get_icon_activatable (entry, GTK_ENTRY_ICON_SECONDARY)) {
		gtk_entry_set_icon_activatable (entry,
			GTK_ENTRY_ICON_SECONDARY, showIcon);
		gtk_entry_set_icon_from_stock (entry,
			GTK_ENTRY_ICON_SECONDARY, showIcon ? GTK_STOCK_CLEAR : NULL);
		if (showIcon)
			gtk_entry_set_icon_tooltip_text (entry,
				GTK_ENTRY_ICON_SECONDARY, _("Clear"));
	}
}
Ejemplo n.º 24
0
void plugin_init(GeanyData *data)
{
	conf = g_build_path(G_DIR_SEPARATOR_S, geany_data->app->configdir, "plugins", "quick-find.conf", NULL);
	config = g_key_file_new();
	g_key_file_load_from_file(config, conf, G_KEY_FILE_NONE, NULL);
	executable = utils_get_setting_string(config, "main", "executable", DEFAULT_EXECUTABLE);

	trim_file = g_regex_new(g_strconcat("^.*", G_DIR_SEPARATOR_S, NULL), G_REGEX_OPTIMIZE | G_REGEX_CASELESS, 0, NULL);
	trim_regex = g_regex_new("\n$", G_REGEX_OPTIMIZE | G_REGEX_CASELESS, 0, NULL);
	
	label = gtk_label_new(_("Find"));
	panel = gtk_vbox_new(FALSE, 6);
	scrollable_table = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollable_table), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	gtk_box_pack_start(GTK_BOX(panel), scrollable_table, TRUE, TRUE, 0);
	gtk_notebook_append_page(GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), panel, label);
	
	entry = gtk_entry_new();
	gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FIND);
	g_signal_connect(entry, "activate", G_CALLBACK(on_activate), NULL);
	
	GtkWidget *button_box = gtk_hbox_new(FALSE, 6);
	gtk_box_pack_start(GTK_BOX(button_box), entry, TRUE, TRUE, 0);
	
	GtkWidget *button = gtk_button_new_with_label(_("Find"));
	g_signal_connect(button, "clicked", G_CALLBACK(on_click), NULL);
	gtk_box_pack_end(GTK_BOX(button_box), button, FALSE, TRUE, 0);
	
	check_case = gtk_check_button_new_with_label(_("Case Sensitive"));
	ui_widget_set_tooltip_text(check_case, _("Perform a case-sensitive search."));
	
	gtk_box_pack_end(GTK_BOX(panel), check_case, FALSE, TRUE, 0);
	gtk_box_pack_end(GTK_BOX(panel), button_box, FALSE, TRUE, 0);
	gtk_container_set_focus_child(GTK_CONTAINER(panel), entry);

	GtkTreeViewColumn *number_column, *line_column, *file_column, *text_column;
	GtkCellRenderer *render;
	
	list = gtk_tree_store_new(4, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
	tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list));

	render = gtk_cell_renderer_text_new();
	number_column = gtk_tree_view_column_new_with_attributes("#", render, NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), number_column);
	gtk_tree_view_column_set_alignment(number_column, 1.0);
	gtk_cell_renderer_set_alignment(render, 1.0, 0.0);
	gtk_tree_view_column_add_attribute(number_column, render, "text", 0);
	
	render = gtk_cell_renderer_text_new();
	line_column = gtk_tree_view_column_new_with_attributes("Line", render, NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), line_column);
	gtk_tree_view_column_set_alignment(line_column, 1.0);
	gtk_cell_renderer_set_alignment(render, 1.0, 0.0);
	gtk_tree_view_column_add_attribute(line_column, render, "text", 1);
	
	render = gtk_cell_renderer_text_new();
	file_column = gtk_tree_view_column_new_with_attributes("File", render, NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), file_column);
	gtk_tree_view_column_add_attribute(file_column, render, "text", 2);
	gtk_tree_view_column_set_cell_data_func(file_column, render, (GtkTreeCellDataFunc)cell_data, NULL, NULL);
	
	render = gtk_cell_renderer_text_new();
	text_column = gtk_tree_view_column_new_with_attributes("Text", render, NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), text_column);
	gtk_tree_view_column_add_attribute(text_column, render, "text", 3);

	g_object_unref(GTK_TREE_MODEL(list));
	GtkTreeSelection *select = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
	g_signal_connect(select, "changed", G_CALLBACK(selected_row), NULL);
	
	gtk_container_add(GTK_CONTAINER(scrollable_table), tree);
	gtk_widget_show(label);
	gtk_widget_show_all(panel);
	
	g_signal_connect(geany->main_widgets->window, "key-release-event", G_CALLBACK(panel_focus_tab), NULL);

	GeanyKeyGroup *key_group;
	key_group = plugin_set_key_group(geany_plugin, "quick_find_keyboard_shortcut", KB_GROUP, NULL);
	keybindings_set_item(key_group, KB_QUICK_FIND, entry_focus, 0, 0, "quick_find", _("Quick Find..."), NULL);
}
Ejemplo n.º 25
0
gboolean yatla_layout_load_layout (YatlaLayout* self, YatlaSidebar* sidebar, const gchar* list_name) {
	gboolean result = FALSE;
	Block4Data* _data4_;
	YatlaSidebar* _tmp0_ = NULL;
	YatlaSidebar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	GtkBox* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	GtkLabel* _tmp8_ = NULL;
	GtkLabel* _tmp9_ = NULL;
	GtkLabel* _tmp10_ = NULL;
	GtkLabel* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	gchar* _tmp13_ = NULL;
	gchar* _tmp14_ = NULL;
	GtkBox* _tmp15_ = NULL;
	GtkLabel* _tmp16_ = NULL;
	GtkBox* _tmp17_ = NULL;
	GtkEntry* _tmp18_ = NULL;
	GtkEntry* _tmp19_ = NULL;
	GtkEntry* _tmp20_ = NULL;
	GtkBox* _tmp21_ = NULL;
	GtkEntry* _tmp22_ = NULL;
	GtkBox* _tmp23_ = NULL;
	gint list_index = 0;
	YatlaSidebar* _tmp24_ = NULL;
	GList* _tmp25_ = NULL;
	gint task_index = 0;
	guint the_longest_task = 0U;
	GtkBox* _tmp122_ = NULL;
	GtkBox* _tmp123_ = NULL;
	GtkBox* _tmp124_ = NULL;
	guint _tmp125_ = 0U;
	GeeTreeMap* _tmp126_ = NULL;
	GeeCollection* _tmp127_ = NULL;
	GeeCollection* _tmp128_ = NULL;
	GeeCollection* _tmp129_ = NULL;
	gint _tmp130_ = 0;
	gint _tmp131_ = 0;
	GtkEntry* _tmp132_ = NULL;
	GeeMapIterator* map_iterator = NULL;
	GeeTreeMap* _tmp133_ = NULL;
	GeeMapIterator* _tmp134_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (sidebar != NULL, FALSE);
	g_return_val_if_fail (list_name != NULL, FALSE);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	_tmp0_ = sidebar;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data4_->sidebar);
	_data4_->sidebar = _tmp1_;
	_tmp2_ = list_name;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (_data4_->list_name);
	_data4_->list_name = _tmp3_;
	_tmp4_ = _data4_->list_name;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 (self->_name);
	self->_name = _tmp5_;
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->_top_box1);
	self->_top_box1 = _tmp6_;
	_tmp7_ = _data4_->list_name;
	_tmp8_ = (GtkLabel*) gtk_label_new (_tmp7_);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->_list_name);
	self->_list_name = _tmp8_;
	_tmp9_ = self->_list_name;
	gtk_label_set_use_markup (_tmp9_, TRUE);
	_tmp10_ = self->_list_name;
	_tmp11_ = self->_list_name;
	_tmp12_ = gtk_label_get_text (_tmp11_);
	_tmp13_ = g_strdup_printf ("<span font='14'><b>%s</b></span>", _tmp12_);
	_tmp14_ = _tmp13_;
	gtk_label_set_markup (_tmp10_, _tmp14_);
	_g_free0 (_tmp14_);
	_tmp15_ = self->_top_box1;
	_tmp16_ = self->_list_name;
	gtk_box_pack_start (_tmp15_, (GtkWidget*) _tmp16_, TRUE, TRUE, (guint) 0);
	_tmp17_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->_top_box2);
	self->_top_box2 = _tmp17_;
	_tmp18_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->new_task_entry);
	self->new_task_entry = _tmp18_;
	_tmp19_ = self->new_task_entry;
	gtk_entry_set_placeholder_text (_tmp19_, "Add new task");
	_tmp20_ = self->new_task_entry;
	gtk_entry_set_icon_from_stock (_tmp20_, GTK_ENTRY_ICON_SECONDARY, "gtk-edit");
	_tmp21_ = self->_top_box2;
	_tmp22_ = self->new_task_entry;
	gtk_box_pack_start (_tmp21_, (GtkWidget*) _tmp22_, TRUE, TRUE, (guint) 0);
	_tmp23_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
	g_object_ref_sink (_tmp23_);
	_g_object_unref0 (self->_tasks_box);
	self->_tasks_box = _tmp23_;
	list_index = 0;
	_tmp24_ = _data4_->sidebar;
	_tmp25_ = _tmp24_->sidebar_list;
	{
		GList* list_collection = NULL;
		GList* list_it = NULL;
		list_collection = _tmp25_;
		for (list_it = list_collection; list_it != NULL; list_it = list_it->next) {
			YatlaList* _tmp26_ = NULL;
			YatlaList* list = NULL;
			_tmp26_ = _g_object_ref0 ((YatlaList*) list_it->data);
			list = _tmp26_;
			{
				YatlaList* _tmp27_ = NULL;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_ = NULL;
				const gchar* _tmp30_ = NULL;
				gint _tmp31_ = 0;
				_tmp27_ = list;
				_tmp28_ = yatla_list_get_name (_tmp27_);
				_tmp29_ = _tmp28_;
				_tmp30_ = _data4_->list_name;
				if (g_strcmp0 (_tmp29_, _tmp30_) == 0) {
					_g_object_unref0 (list);
					break;
				}
				_tmp31_ = list_index;
				list_index = _tmp31_ + 1;
				_g_object_unref0 (list);
			}
		}
	}
	task_index = 0;
	the_longest_task = (guint) 0;
	while (TRUE) {
		Block5Data* _data5_;
		gint _tmp32_ = 0;
		YatlaSidebar* _tmp33_ = NULL;
		GList* _tmp34_ = NULL;
		gint _tmp35_ = 0;
		gconstpointer _tmp36_ = NULL;
		guint _tmp37_ = 0U;
		guint _tmp38_ = 0U;
		gint task_id = 0;
		YatlaSidebar* _tmp39_ = NULL;
		GList* _tmp40_ = NULL;
		gint _tmp41_ = 0;
		gconstpointer _tmp42_ = NULL;
		GList* _tmp43_ = NULL;
		gint _tmp44_ = 0;
		gconstpointer _tmp45_ = NULL;
		gint _tmp46_ = 0;
		gint _tmp47_ = 0;
		gchar* task_name = NULL;
		YatlaSidebar* _tmp48_ = NULL;
		GList* _tmp49_ = NULL;
		gint _tmp50_ = 0;
		gconstpointer _tmp51_ = NULL;
		GList* _tmp52_ = NULL;
		gint _tmp53_ = 0;
		gconstpointer _tmp54_ = NULL;
		const gchar* _tmp55_ = NULL;
		const gchar* _tmp56_ = NULL;
		gchar* _tmp57_ = NULL;
		YatlaSidebar* _tmp58_ = NULL;
		GList* _tmp59_ = NULL;
		gint _tmp60_ = 0;
		gconstpointer _tmp61_ = NULL;
		GList* _tmp62_ = NULL;
		gint _tmp63_ = 0;
		gconstpointer _tmp64_ = NULL;
		const gchar* _tmp65_ = NULL;
		const gchar* _tmp66_ = NULL;
		gchar* _tmp67_ = NULL;
		GDateTime* task_date = NULL;
		YatlaSidebar* _tmp68_ = NULL;
		GList* _tmp69_ = NULL;
		gint _tmp70_ = 0;
		gconstpointer _tmp71_ = NULL;
		GList* _tmp72_ = NULL;
		gint _tmp73_ = 0;
		gconstpointer _tmp74_ = NULL;
		GDateTime* _tmp75_ = NULL;
		GDateTime* _tmp76_ = NULL;
		gboolean task_is_done = FALSE;
		YatlaSidebar* _tmp87_ = NULL;
		GList* _tmp88_ = NULL;
		gint _tmp89_ = 0;
		gconstpointer _tmp90_ = NULL;
		GList* _tmp91_ = NULL;
		gint _tmp92_ = 0;
		gconstpointer _tmp93_ = NULL;
		gboolean _tmp94_ = FALSE;
		gboolean _tmp95_ = FALSE;
		YatlaTask* task = NULL;
		const gchar* _tmp96_ = NULL;
		const gchar* _tmp97_ = NULL;
		GDateTime* _tmp98_ = NULL;
		gboolean _tmp99_ = FALSE;
		YatlaTask* _tmp100_ = NULL;
		YatlaTask* _tmp101_ = NULL;
		gint _tmp102_ = 0;
		const gchar* _tmp103_ = NULL;
		gint _tmp104_ = 0;
		gint _tmp105_ = 0;
		guint _tmp106_ = 0U;
		GtkCheckButton* checkBox = NULL;
		const gchar* _tmp110_ = NULL;
		GtkCheckButton* _tmp111_ = NULL;
		GtkCheckButton* _tmp112_ = NULL;
		gboolean _tmp113_ = FALSE;
		GtkCheckButton* _tmp114_ = NULL;
		GtkCheckButton* _tmp115_ = NULL;
		GeeTreeMap* _tmp116_ = NULL;
		YatlaTask* _tmp117_ = NULL;
		GtkCheckButton* _tmp118_ = NULL;
		GtkBox* _tmp119_ = NULL;
		GtkCheckButton* _tmp120_ = NULL;
		gint _tmp121_ = 0;
		_data5_ = g_slice_new0 (Block5Data);
		_data5_->_ref_count_ = 1;
		_data5_->_data4_ = block4_data_ref (_data4_);
		_tmp32_ = task_index;
		_tmp33_ = _data4_->sidebar;
		_tmp34_ = _tmp33_->sidebar_list;
		_tmp35_ = list_index;
		_tmp36_ = g_list_nth_data (_tmp34_, (guint) _tmp35_);
		_tmp37_ = yatla_list_get_size ((YatlaList*) _tmp36_);
		_tmp38_ = _tmp37_;
		if (!(((guint) _tmp32_) != _tmp38_)) {
			block5_data_unref (_data5_);
			_data5_ = NULL;
			break;
		}
		_tmp39_ = _data4_->sidebar;
		_tmp40_ = _tmp39_->sidebar_list;
		_tmp41_ = list_index;
		_tmp42_ = g_list_nth_data (_tmp40_, (guint) _tmp41_);
		_tmp43_ = ((YatlaList*) _tmp42_)->tasks;
		_tmp44_ = task_index;
		_tmp45_ = g_list_nth_data (_tmp43_, (guint) _tmp44_);
		_tmp46_ = yatla_task_get_id ((YatlaTask*) _tmp45_);
		_tmp47_ = _tmp46_;
		task_id = _tmp47_;
		_tmp48_ = _data4_->sidebar;
		_tmp49_ = _tmp48_->sidebar_list;
		_tmp50_ = list_index;
		_tmp51_ = g_list_nth_data (_tmp49_, (guint) _tmp50_);
		_tmp52_ = ((YatlaList*) _tmp51_)->tasks;
		_tmp53_ = task_index;
		_tmp54_ = g_list_nth_data (_tmp52_, (guint) _tmp53_);
		_tmp55_ = yatla_task_get_name ((YatlaTask*) _tmp54_);
		_tmp56_ = _tmp55_;
		_tmp57_ = g_strdup (_tmp56_);
		task_name = _tmp57_;
		_tmp58_ = _data4_->sidebar;
		_tmp59_ = _tmp58_->sidebar_list;
		_tmp60_ = list_index;
		_tmp61_ = g_list_nth_data (_tmp59_, (guint) _tmp60_);
		_tmp62_ = ((YatlaList*) _tmp61_)->tasks;
		_tmp63_ = task_index;
		_tmp64_ = g_list_nth_data (_tmp62_, (guint) _tmp63_);
		_tmp65_ = yatla_task_get_note ((YatlaTask*) _tmp64_);
		_tmp66_ = _tmp65_;
		_tmp67_ = g_strdup (_tmp66_);
		_data5_->task_note = _tmp67_;
		_tmp68_ = _data4_->sidebar;
		_tmp69_ = _tmp68_->sidebar_list;
		_tmp70_ = list_index;
		_tmp71_ = g_list_nth_data (_tmp69_, (guint) _tmp70_);
		_tmp72_ = ((YatlaList*) _tmp71_)->tasks;
		_tmp73_ = task_index;
		_tmp74_ = g_list_nth_data (_tmp72_, (guint) _tmp73_);
		_tmp75_ = yatla_task_get_date ((YatlaTask*) _tmp74_);
		_tmp76_ = _tmp75_;
		if (_tmp76_ != NULL) {
			YatlaSidebar* _tmp77_ = NULL;
			GList* _tmp78_ = NULL;
			gint _tmp79_ = 0;
			gconstpointer _tmp80_ = NULL;
			GList* _tmp81_ = NULL;
			gint _tmp82_ = 0;
			gconstpointer _tmp83_ = NULL;
			GDateTime* _tmp84_ = NULL;
			GDateTime* _tmp85_ = NULL;
			GDateTime* _tmp86_ = NULL;
			_tmp77_ = _data4_->sidebar;
			_tmp78_ = _tmp77_->sidebar_list;
			_tmp79_ = list_index;
			_tmp80_ = g_list_nth_data (_tmp78_, (guint) _tmp79_);
			_tmp81_ = ((YatlaList*) _tmp80_)->tasks;
			_tmp82_ = task_index;
			_tmp83_ = g_list_nth_data (_tmp81_, (guint) _tmp82_);
			_tmp84_ = yatla_task_get_date ((YatlaTask*) _tmp83_);
			_tmp85_ = _tmp84_;
			_tmp86_ = _g_date_time_ref0 (_tmp85_);
			_g_date_time_unref0 (task_date);
			task_date = _tmp86_;
		} else {
			_g_date_time_unref0 (task_date);
			task_date = NULL;
		}
		_tmp87_ = _data4_->sidebar;
		_tmp88_ = _tmp87_->sidebar_list;
		_tmp89_ = list_index;
		_tmp90_ = g_list_nth_data (_tmp88_, (guint) _tmp89_);
		_tmp91_ = ((YatlaList*) _tmp90_)->tasks;
		_tmp92_ = task_index;
		_tmp93_ = g_list_nth_data (_tmp91_, (guint) _tmp92_);
		_tmp94_ = yatla_task_get_is_done ((YatlaTask*) _tmp93_);
		_tmp95_ = _tmp94_;
		task_is_done = _tmp95_;
		_tmp96_ = task_name;
		_tmp97_ = _data5_->task_note;
		_tmp98_ = task_date;
		_tmp99_ = task_is_done;
		_tmp100_ = yatla_task_new (_tmp96_, _tmp97_, _tmp98_, _tmp99_);
		task = _tmp100_;
		_tmp101_ = task;
		_tmp102_ = task_id;
		yatla_task_set_id (_tmp101_, _tmp102_);
		_tmp103_ = task_name;
		_tmp104_ = strlen (_tmp103_);
		_tmp105_ = _tmp104_;
		_tmp106_ = the_longest_task;
		if (((guint) _tmp105_) > _tmp106_) {
			const gchar* _tmp107_ = NULL;
			gint _tmp108_ = 0;
			gint _tmp109_ = 0;
			_tmp107_ = task_name;
			_tmp108_ = strlen (_tmp107_);
			_tmp109_ = _tmp108_;
			the_longest_task = (guint) _tmp109_;
		}
		_tmp110_ = task_name;
		_tmp111_ = (GtkCheckButton*) gtk_check_button_new_with_label (_tmp110_);
		g_object_ref_sink (_tmp111_);
		checkBox = _tmp111_;
		_tmp112_ = checkBox;
		_tmp113_ = task_is_done;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp112_, _tmp113_);
		_tmp114_ = checkBox;
		gtk_widget_set_has_tooltip ((GtkWidget*) _tmp114_, TRUE);
		_tmp115_ = checkBox;
		g_signal_connect_data ((GtkWidget*) _tmp115_, "query-tooltip", (GCallback) ____lambda4__gtk_widget_query_tooltip, block5_data_ref (_data5_), (GClosureNotify) block5_data_unref, 0);
		_tmp116_ = self->tasks;
		_tmp117_ = task;
		_tmp118_ = checkBox;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp116_, _tmp117_, _tmp118_);
		_tmp119_ = self->_tasks_box;
		_tmp120_ = checkBox;
		gtk_box_pack_start (_tmp119_, (GtkWidget*) _tmp120_, TRUE, TRUE, (guint) 0);
		_tmp121_ = task_index;
		task_index = _tmp121_ + 1;
		_g_object_unref0 (checkBox);
		_g_object_unref0 (task);
		_g_date_time_unref0 (task_date);
		_g_free0 (task_name);
		block5_data_unref (_data5_);
		_data5_ = NULL;
	}
	_tmp122_ = self->_top_box1;
	gtk_layout_put ((GtkLayout*) self, (GtkWidget*) _tmp122_, 25, 20);
	_tmp123_ = self->_top_box2;
	gtk_layout_put ((GtkLayout*) self, (GtkWidget*) _tmp123_, 20, 40);
	_tmp124_ = self->_tasks_box;
	gtk_layout_put ((GtkLayout*) self, (GtkWidget*) _tmp124_, 20, 100);
	_tmp125_ = the_longest_task;
	g_object_set ((GtkLayout*) self, "width", 65 + (_tmp125_ * 7), NULL);
	_tmp126_ = self->tasks;
	_tmp127_ = gee_abstract_map_get_values ((GeeMap*) _tmp126_);
	_tmp128_ = _tmp127_;
	_tmp129_ = _tmp128_;
	_tmp130_ = gee_collection_get_size (_tmp129_);
	_tmp131_ = _tmp130_;
	g_object_set ((GtkLayout*) self, "height", (guint) (100 + (_tmp131_ * 30)), NULL);
	_g_object_unref0 (_tmp129_);
	gtk_widget_show_all ((GtkWidget*) self);
	_tmp132_ = self->new_task_entry;
	g_signal_connect_data (_tmp132_, "icon-press", (GCallback) ___lambda5__gtk_entry_icon_press, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_tmp133_ = self->tasks;
	_tmp134_ = gee_abstract_map_map_iterator ((GeeAbstractMap*) _tmp133_);
	map_iterator = _tmp134_;
	while (TRUE) {
		Block6Data* _data6_;
		GeeMapIterator* _tmp135_ = NULL;
		gboolean _tmp136_ = FALSE;
		GeeMapIterator* _tmp137_ = NULL;
		gpointer _tmp138_ = NULL;
		GeeMapIterator* _tmp139_ = NULL;
		gpointer _tmp140_ = NULL;
		GtkCheckButton* _tmp141_ = NULL;
		_data6_ = g_slice_new0 (Block6Data);
		_data6_->_ref_count_ = 1;
		_data6_->_data4_ = block4_data_ref (_data4_);
		_tmp135_ = map_iterator;
		_tmp136_ = gee_map_iterator_next (_tmp135_);
		if (!_tmp136_) {
			block6_data_unref (_data6_);
			_data6_ = NULL;
			break;
		}
		_tmp137_ = map_iterator;
		_tmp138_ = gee_map_iterator_get_value (_tmp137_);
		_data6_->checkBox = (GtkCheckButton*) _tmp138_;
		_tmp139_ = map_iterator;
		_tmp140_ = gee_map_iterator_get_key (_tmp139_);
		_data6_->task = (YatlaTask*) _tmp140_;
		_tmp141_ = _data6_->checkBox;
		g_signal_connect_data ((GObject*) _tmp141_, "notify::active", (GCallback) ____lambda11__g_object_notify, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
		block6_data_unref (_data6_);
		_data6_ = NULL;
	}
	result = TRUE;
	_g_object_unref0 (map_iterator);
	block4_data_unref (_data4_);
	_data4_ = NULL;
	return result;
}
Ejemplo n.º 26
0
int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *table;
  GtkWidget *label;
  GtkWidget *entry;
  GtkWidget *button;
  GIcon *icon;
  GtkTargetList *tlist;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Gtk Entry Icons Test");
  gtk_container_set_border_width (GTK_CONTAINER (window), 12);

  g_signal_connect (G_OBJECT (window), "destroy",
		    G_CALLBACK (gtk_main_quit), NULL);

  table = gtk_table_new (2, 4, FALSE);
  gtk_container_add (GTK_CONTAINER (window), table);
  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table), 6);

  /*
   * Open File - Sets the icon using a GIcon
   */
  label = gtk_label_new ("Open File:");
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
		    GTK_FILL, GTK_FILL, 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);

  entry = gtk_entry_new ();
  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
		    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);

  icon = g_themed_icon_new ("folder");
  g_themed_icon_append_name (G_THEMED_ICON (icon), "gtk-directory");

  gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
				 GTK_ENTRY_ICON_PRIMARY,
				 icon);
  gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
			        GTK_ENTRY_ICON_PRIMARY,
				FALSE);

  gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
				   GTK_ENTRY_ICON_PRIMARY,
				   "Open a file");

  button = gtk_button_new_with_label ("Properties");
  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
		    GTK_FILL, GTK_FILL, 0, 0);
  g_signal_connect (button, "clicked", 
                    G_CALLBACK (properties_cb), entry);                    

  
  /*
   * Save File - sets the icon using a stock id.
   */
  label = gtk_label_new ("Save File:");
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
		    GTK_FILL, GTK_FILL, 0, 0);
  gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);

  entry = gtk_entry_new ();
  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,
		    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
  gtk_entry_set_text (GTK_ENTRY (entry), "‏Right-to-left");
  gtk_widget_set_direction (entry, GTK_TEXT_DIR_RTL);
  
  gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
				 GTK_ENTRY_ICON_PRIMARY,
				 GTK_STOCK_SAVE);
  gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
				   GTK_ENTRY_ICON_PRIMARY,
				   "Save a file");
  tlist = gtk_target_list_new (NULL, 0);
  gtk_target_list_add_text_targets (tlist, 0);
  gtk_entry_set_icon_drag_source (GTK_ENTRY (entry),
                                  GTK_ENTRY_ICON_PRIMARY,
                                  tlist, GDK_ACTION_COPY); 
  g_signal_connect_after (entry, "drag-begin", 
                          G_CALLBACK (drag_begin_cb), NULL);
  g_signal_connect (entry, "drag-data-get", 
                    G_CALLBACK (drag_data_get_cb), NULL);
  gtk_target_list_unref (tlist);

  button = gtk_button_new_with_label ("Properties");
  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
		    GTK_FILL, GTK_FILL, 0, 0);
  g_signal_connect (button, "clicked", 
                    G_CALLBACK (properties_cb), entry);                    

  /*
   * Search - Uses a helper function
   */
  label = gtk_label_new ("Search:");
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
		    GTK_FILL, GTK_FILL, 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);

  entry = gtk_entry_new ();
  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3,
		    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);

  gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
				 GTK_ENTRY_ICON_PRIMARY,
				 GTK_STOCK_FIND);

  gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
				 GTK_ENTRY_ICON_SECONDARY,
				 GTK_STOCK_CLEAR);

  g_signal_connect (entry, "icon-press", G_CALLBACK (clear_pressed), NULL);

  button = gtk_button_new_with_label ("Properties");
  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 2, 3,
		    GTK_FILL, GTK_FILL, 0, 0);
  g_signal_connect (button, "clicked", 
                    G_CALLBACK (properties_cb), entry);                    

  /*
   * Password - Sets the icon using a stock id
   */
  label = gtk_label_new ("Password:"******"Properties");
  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 3, 4,
		    GTK_FILL, GTK_FILL, 0, 0);
  g_signal_connect (button, "clicked", 
                    G_CALLBACK (properties_cb), entry);                    

  /* Name - Does not set any icons. */
  label = gtk_label_new ("Name:");
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
		    GTK_FILL, GTK_FILL, 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);

  entry = gtk_entry_new ();
  gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 4, 5,
		    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);

  button = gtk_button_new_with_label ("Properties");
  gtk_table_attach (GTK_TABLE (table), button, 2, 3, 4, 5,
		    GTK_FILL, GTK_FILL, 0, 0);
  g_signal_connect (button, "clicked", 
                    G_CALLBACK (properties_cb), entry);                    

  gtk_widget_show_all (window);

  gtk_main();

  return 0;
}
static void
empathy_password_dialog_constructed (GObject *object)
{
  EmpathyPasswordDialog *dialog;
  EmpathyPasswordDialogPriv *priv;
  TpAccount *account;
  GtkWidget *icon;
  GtkBox *box;
  gchar *text;

  dialog = EMPATHY_PASSWORD_DIALOG (object);
  priv = dialog->priv;

  g_assert (priv->handler != NULL);

  priv->grabbing = FALSE;

  account = empathy_server_sasl_handler_get_account (priv->handler);

  tp_g_signal_connect_object (priv->handler, "invalidated",
      G_CALLBACK (password_dialog_handler_invalidated_cb),
      object, 0);

  /* dialog */
  gtk_dialog_add_button (GTK_DIALOG (dialog),
      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);

  priv->ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
      GTK_STOCK_OK, GTK_RESPONSE_OK);
  gtk_widget_set_sensitive (priv->ok_button, FALSE);

  text = g_strdup_printf (_("Enter your password for account\n<b>%s</b>"),
      tp_account_get_display_name (account));
  gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), text);
  g_free (text);

  gtk_window_set_icon_name (GTK_WINDOW (dialog),
      GTK_STOCK_DIALOG_AUTHENTICATION);

  box = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));

  /* dialog icon */
  icon = gtk_image_new_from_icon_name (tp_account_get_icon_name (account),
      GTK_ICON_SIZE_DIALOG);
  gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), icon);
  gtk_widget_show (icon);

  /* entry */
  priv->entry = gtk_entry_new ();
  gtk_entry_set_visibility (GTK_ENTRY (priv->entry), FALSE);

  /* entry clear icon */
  gtk_entry_set_icon_from_stock (GTK_ENTRY (priv->entry),
      GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
  gtk_entry_set_icon_sensitive (GTK_ENTRY (priv->entry),
      GTK_ENTRY_ICON_SECONDARY, FALSE);

  g_signal_connect (priv->entry, "icon-release",
      G_CALLBACK (clear_icon_released_cb), NULL);
  g_signal_connect (priv->entry, "changed",
      G_CALLBACK (password_entry_changed_cb), dialog);
  g_signal_connect (priv->entry, "activate",
      G_CALLBACK (password_entry_activate_cb), dialog);

  gtk_box_pack_start (box, priv->entry, FALSE, FALSE, 0);
  gtk_widget_show (priv->entry);

  /* remember password ticky box */
  priv->ticky = gtk_check_button_new_with_label (_("Remember password"));

  gtk_box_pack_start (box, priv->ticky, FALSE, FALSE, 0);

  /* only show it if we actually support it */
  if (empathy_server_sasl_handler_can_save_response_somewhere (priv->handler))
    gtk_widget_show (priv->ticky);

  g_signal_connect (dialog, "response",
      G_CALLBACK (password_dialog_response_cb), dialog);
  g_signal_connect (dialog, "window-state-event",
      G_CALLBACK (password_dialog_window_state_changed), dialog);
  g_signal_connect (dialog, "map-event",
      G_CALLBACK (password_dialog_grab_keyboard), dialog);
  g_signal_connect (dialog, "unmap-event",
      G_CALLBACK (password_dialog_ungrab_keyboard), dialog);

  gtk_widget_grab_focus (priv->entry);

  gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
}
Ejemplo n.º 28
0
static void ugtk_download_form_init_page1 (UgtkDownloadForm* dform, UgtkProxyForm* proxy)
{
	GtkWidget*	widget;
	GtkGrid*	top_grid;
	GtkGrid*	grid;
	GtkWidget*	frame;
	GtkBox*	    top_vbox;
	GtkWidget*	vbox;
	GtkWidget*	hbox;

	dform->page1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	top_vbox = (GtkBox*) dform->page1;
	gtk_container_set_border_width (GTK_CONTAINER (top_vbox), 2);

	top_grid = (GtkGrid*) gtk_grid_new ();
	gtk_box_pack_start (top_vbox, (GtkWidget*) top_grid, FALSE, FALSE, 0);

	// URL - entry
	widget = gtk_entry_new ();
//	gtk_entry_set_width_chars (GTK_ENTRY (widget), 20); // remove for GTK+ 3.12
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin-left", 1, "margin-right", 1, NULL);
	g_object_set (widget, "margin-top", 2, "margin-bottom", 2, NULL);
	g_object_set (widget, "hexpand", TRUE, NULL);
	gtk_grid_attach (top_grid, widget, 1, 0, 2, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_uri_entry_changed), dform);
	dform->uri_entry = widget;
	// URL - label
	widget = gtk_label_new_with_mnemonic (_("_URI:"));
	gtk_label_set_mnemonic_widget (GTK_LABEL(widget), dform->uri_entry);
	g_object_set (widget, "margin-left", 3, "margin-right", 3, NULL);
	g_object_set (widget, "margin-top", 2, "margin-bottom", 2, NULL);
	gtk_grid_attach (top_grid, widget, 0, 0, 1, 1);
	dform->uri_label = widget;

	// Mirrors - entry
	widget = gtk_entry_new ();
//	gtk_entry_set_width_chars (GTK_ENTRY (widget), 20); // remove for GTK+ 3.12
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin-left", 1, "margin-right", 1, NULL);
	g_object_set (widget, "margin-top", 2, "margin-bottom", 2, NULL);
	g_object_set (widget, "hexpand", TRUE, NULL);
	gtk_grid_attach (top_grid, widget, 1, 1, 2, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_uri_entry_changed), dform);
	dform->mirrors_entry = widget;
	// Mirrors - label
	widget = gtk_label_new_with_mnemonic (_("Mirrors:"));
	gtk_label_set_mnemonic_widget (GTK_LABEL(widget), dform->mirrors_entry);
	g_object_set (widget, "margin-left", 3, "margin-right", 3, NULL);
	g_object_set (widget, "margin-top", 2, "margin-bottom", 2, NULL);
	gtk_grid_attach (top_grid, widget, 0, 1, 1, 1);
	dform->mirrors_label = widget;

	// File - entry
	widget = gtk_entry_new ();
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (top_grid, widget,  1, 2, 2, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_entry_changed), dform);
	dform->file_entry = widget;
	// File - label
	widget = gtk_label_new_with_mnemonic (_("File:"));
	gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dform->file_entry);
	g_object_set (widget, "margin-left", 3, "margin-right", 3, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (top_grid, widget,  0, 2, 1, 1);
	dform->file_label = widget;

	// Folder - combo entry + icon
	dform->folder_combo = gtk_combo_box_text_new_with_entry ();
	dform->folder_entry = gtk_bin_get_child (GTK_BIN (dform->folder_combo));
	widget = dform->folder_entry;
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
#if GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 10
	gtk_entry_set_icon_from_icon_name (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, "folder");
#else
	gtk_entry_set_icon_from_stock (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIRECTORY);
#endif
	gtk_entry_set_icon_tooltip_text (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, _("Select Folder"));
	g_object_set (dform->folder_combo, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (top_grid, dform->folder_combo,  1, 3, 1, 1);
	g_signal_connect (widget, "icon-release",
			G_CALLBACK (on_select_folder), dform);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_entry_changed), dform);
	// Folder - label
	widget = gtk_label_new_with_mnemonic (_("_Folder:"));
	gtk_label_set_mnemonic_widget(GTK_LABEL (widget), dform->folder_combo);
	g_object_set (widget, "margin-left", 3, "margin-right", 3, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (top_grid, widget,  0, 3, 1, 1);

	// Referrer - entry
	widget = gtk_entry_new ();
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (top_grid, widget, 1, 4, 2, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_http_entry_changed), dform);
	dform->referrer_entry = widget;
	// Referrer - label
	widget = gtk_label_new_with_mnemonic (_("Referrer:"));
	gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dform->referrer_entry);
	g_object_set (widget, "margin-left", 3, "margin-right", 3, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (top_grid, widget, 0, 4, 1, 1);
//	dform->referrer_label = widget;

	// ----------------------------------------------------
	// Connections
	// HBox for Connections
	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	gtk_box_pack_start (top_vbox, hbox, FALSE, FALSE, 2);
	// connections - label
//	widget = gtk_label_new (_("connections"));
//	gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 2);
//	dform->label_connections = widget;
	// connections - spin button
	widget = gtk_spin_button_new_with_range (1.0, 16.0, 1.0);
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
//	gtk_entry_set_width_chars (GTK_ENTRY (widget), 3); // remove for GTK+ 3.12
	gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 2);
	dform->spin_connections = widget;
	// "Max Connections:" - title label
	widget = gtk_label_new_with_mnemonic (_("_Max Connections:"));
	gtk_label_set_mnemonic_widget ((GtkLabel*)widget, dform->spin_connections);
	gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 2);
	dform->title_connections = widget;

	// ----------------------------------------------------
	// HBox for "Status" and "Login"
	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	gtk_box_pack_start (top_vbox, hbox, FALSE, FALSE, 2);

	// ----------------------------------------------------
	// frame for Status (start mode)
	frame = gtk_frame_new (_("Status"));
	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
	gtk_container_add (GTK_CONTAINER (frame), vbox);
	gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
	dform->radio_runnable = gtk_radio_button_new_with_mnemonic (NULL,
				_("_Runnable"));
	dform->radio_pause = gtk_radio_button_new_with_mnemonic_from_widget (
				(GtkRadioButton*)dform->radio_runnable, _("P_ause"));
	gtk_box_pack_start (GTK_BOX (vbox), dform->radio_runnable, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (vbox), dform->radio_pause, FALSE, FALSE, 0);

	// ----------------------------------------------------
	// frame for login
	frame = gtk_frame_new (_("Login"));
	grid  = (GtkGrid*) gtk_grid_new ();
	gtk_container_set_border_width (GTK_CONTAINER (grid), 2);
	gtk_container_add (GTK_CONTAINER (frame), (GtkWidget*) grid);
	gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 2);
	// User - entry
	widget = gtk_entry_new ();
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (grid, widget, 1, 0, 1, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_entry_changed), dform);
	dform->username_entry = widget;
	// User - label
	widget = gtk_label_new (_("User:"******"margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 0, 1, 1);
//	dform->username_label = widget;

	// Password - entry
	widget = gtk_entry_new ();
	gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (grid, widget, 1, 1, 1, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_entry_changed), dform);
	dform->password_entry = widget;
	// Password - label
	widget = gtk_label_new (_("Password:"******"margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 1, 1, 1);
//	dform->password_label = widget;

	// ----------------------------------------------------
	// proxy
//	ug_proxy_widget_init (&dform->proxy_dform);
	if (proxy) {
		widget = proxy->self;
		gtk_box_pack_start (top_vbox, widget, FALSE, FALSE, 2);
	}
}
Ejemplo n.º 29
0
static void ugtk_download_form_init_page2 (UgtkDownloadForm* dform)
{
	GtkWidget*	widget;
	GtkGrid*	grid;

	dform->page2 = gtk_grid_new ();
	grid = (GtkGrid*) dform->page2;
	gtk_container_set_border_width (GTK_CONTAINER (grid), 2);

	// label - cookie file
	widget = gtk_label_new (_("Cookie file:"));
	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);	// left, center
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 0, 1, 1);
	dform->cookie_label = widget;
	// entry - cookie file
	widget = gtk_entry_new ();
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
#if GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 10
	gtk_entry_set_icon_from_icon_name (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, "text-x-generic");
#else
	gtk_entry_set_icon_from_stock (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FILE);
#endif
	gtk_entry_set_icon_tooltip_text (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, _("Select Cookie File"));
	g_object_set (widget, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (grid, widget, 1, 0, 3, 1);
	g_signal_connect (widget, "icon-release",
			G_CALLBACK (on_select_cookie), dform);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_http_entry_changed), dform);
	dform->cookie_entry = widget;
	// label - post file
	widget = gtk_label_new (_("Post file:"));
	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);	// left, center
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 1, 1, 1);
	dform->post_label = widget;
	// entry - post file
	widget = gtk_entry_new ();
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
#if GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 10
	gtk_entry_set_icon_from_icon_name (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, "text-x-generic");
#else
	gtk_entry_set_icon_from_stock (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FILE);
#endif
	gtk_entry_set_icon_tooltip_text (GTK_ENTRY (widget),
			GTK_ENTRY_ICON_SECONDARY, _("Select Post File"));
	g_object_set (widget, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (grid, widget, 1, 1, 3, 1);
	g_signal_connect (widget, "icon-release",
			G_CALLBACK (on_select_post), dform);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_http_entry_changed), dform);
	dform->post_entry = widget;

	// label - user agent
	widget = gtk_label_new (_("User Agent:"));
	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);	// left, center
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 2, 1, 1);
	dform->agent_label = widget;
	// entry - user agent
	widget = gtk_entry_new ();
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin", 1, "hexpand", TRUE, NULL);
	gtk_grid_attach (grid, widget, 1, 2, 3, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_http_entry_changed), dform);
	dform->agent_entry = widget;

	// Retry limit - label
	widget = gtk_label_new_with_mnemonic (_("Retry _limit:"));
	gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dform->spin_retry);
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 3, 2, 1);
	// Retry limit - spin button
	widget = gtk_spin_button_new_with_range (0.0, 99.0, 1.0);
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 2, 3, 1, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_spin_changed), dform);
	dform->spin_retry = widget;
	// counts - label
	widget = gtk_label_new (_("counts"));
	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 3, 3, 1, 1);

	// Retry delay - label
	widget = gtk_label_new_with_mnemonic (_("Retry _delay:"));
	gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dform->spin_delay);
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 4, 2, 1);
	// Retry delay - spin button
	widget = gtk_spin_button_new_with_range (0.0, 600.0, 1.0);
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 2, 4, 1, 1);
	g_signal_connect (GTK_EDITABLE (widget), "changed",
			G_CALLBACK (on_spin_changed), dform);
	dform->spin_delay = widget;
	// seconds - label
	widget = gtk_label_new (_("seconds"));
	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 3, 4, 1, 1);

	// label - Max upload speed
	widget = gtk_label_new (_("Max upload speed:"));
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 5, 2, 1);
	// spin - Max upload speed
	widget = gtk_spin_button_new_with_range (0, 99999999, 1);
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	gtk_entry_set_width_chars (GTK_ENTRY (widget), 8);
	g_object_set (widget, "margin", 1, NULL);
	gtk_grid_attach (grid, widget, 2, 5, 1, 1);
	dform->spin_upload_speed = (GtkSpinButton*) widget;
	// label - "KiB/s"
	widget = gtk_label_new (_("KiB/s"));
	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);	// left, center
	g_object_set (widget, "margin", 2, "hexpand", TRUE, NULL);
	gtk_grid_attach (grid, widget, 3, 5, 1, 1);

	// label - Max download speed
	widget = gtk_label_new (_("Max download speed:"));
	g_object_set (widget, "margin-left", 2, "margin-right", 2, NULL);
	g_object_set (widget, "margin-top", 1, "margin-bottom", 1, NULL);
	gtk_grid_attach (grid, widget, 0, 6, 2, 1);
	// spin - Max download speed
	widget = gtk_spin_button_new_with_range (0, 99999999, 1);
	gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
	gtk_entry_set_width_chars (GTK_ENTRY (widget), 8);
	g_object_set (widget, "margin", 1, NULL);
	gtk_grid_attach (grid, widget, 2, 6, 1, 1);
	dform->spin_download_speed = (GtkSpinButton*) widget;
	// label - "KiB/s"
	widget = gtk_label_new (_("KiB/s"));
	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);	// left, center
	g_object_set (widget, "margin", 2, "hexpand", TRUE, NULL);
	gtk_grid_attach (grid, widget, 3, 6, 1, 1);

	// Retrieve timestamp
	widget = gtk_check_button_new_with_label (_("Retrieve timestamp"));
	gtk_grid_attach (grid, widget, 0, 7, 3, 1);
	dform->timestamp = (GtkToggleButton*) widget;
}
Ejemplo n.º 30
0
static void ygtk_help_dialog_init (YGtkHelpDialog *dialog)
{
	gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
	gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
	gtk_window_set_title (GTK_WINDOW (dialog), _("Help"));
	GdkPixbuf *icon = gtk_widget_render_icon (
		GTK_WIDGET (dialog), GTK_STOCK_HELP, GTK_ICON_SIZE_MENU, NULL);
	gtk_window_set_icon (GTK_WINDOW (dialog), icon);
	g_object_unref (G_OBJECT (icon));
	gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 450);

	// help text
	dialog->help_box = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy  (GTK_SCROLLED_WINDOW (dialog->help_box),
	                                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (dialog->help_box),
	                                     GTK_SHADOW_IN);
	dialog->help_text = ygtk_html_wrap_new();
	gtk_container_add (GTK_CONTAINER (dialog->help_box), dialog->help_text);

#if 0  // show a nice background image
	GtkIconTheme *theme = gtk_icon_theme_get_default();
	GtkIconInfo *info = gtk_icon_theme_lookup_icon (theme, HELP_IMG_BG, 192, 0);
	if (info) {
		GdkPixbuf *pixbuf = gtk_icon_info_load_icon (info, NULL);
		if (pixbuf) {
			const gchar *filename = gtk_icon_info_get_filename (info);
			GdkPixbuf *transparent = ygutils_setOpacity (pixbuf, 60, FALSE);
			ygtk_html_wrap_set_background (dialog->help_text, transparent, filename);
			g_object_unref (pixbuf);
			g_object_unref (transparent);
		}
		gtk_icon_info_free (info);
	}
#endif

	// bottom part (search entry + close button)
	dialog->search_entry = gtk_entry_new();
	gtk_widget_set_size_request (dialog->search_entry, 140, -1);
	gtk_entry_set_icon_from_stock (GTK_ENTRY (dialog->search_entry),
		GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
	gtk_entry_set_icon_activatable (GTK_ENTRY (dialog->search_entry),
		GTK_ENTRY_ICON_PRIMARY, TRUE);
	g_signal_connect (G_OBJECT (dialog->search_entry), "icon-press",
	                  G_CALLBACK (search_entry_icon_press_cb), dialog);
	g_signal_connect (G_OBJECT (dialog->search_entry), "changed",
	                  G_CALLBACK (search_entry_changed_cb), dialog);
	g_signal_connect (G_OBJECT (dialog->search_entry), "activate",
	                  G_CALLBACK (search_entry_activated_cb), dialog);

	dialog->close_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
        gtk_widget_set_can_default(dialog->close_button, TRUE);

	GtkWidget *close_box = gtk_hbutton_box_new();
	gtk_container_add (GTK_CONTAINER (close_box), dialog->close_button);

	char *label_str = ygutils_mapKBAccel (_("&Find:"));
	GtkWidget *bottom_box, *label = gtk_label_new_with_mnemonic (label_str);
	g_free (label_str);
	gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
	gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->search_entry);

	bottom_box = gtk_hbox_new (FALSE, 2);
	gtk_box_pack_start (GTK_BOX (bottom_box), label, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (bottom_box), dialog->search_entry, FALSE, FALSE, 0);
	gtk_box_pack_end (GTK_BOX (bottom_box), close_box, FALSE, FALSE, 0);

#ifdef SET_HELP_HISTORY
	dialog->history_combo = gtk_combo_box_new_text();
	GList *cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (dialog->history_combo));
	g_object_set (G_OBJECT (cells->data), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
	g_list_free (cells);
#endif

	// glue it
	dialog->vbox = gtk_vbox_new (FALSE, 6);
#ifdef SET_HELP_HISTORY
	GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
	gtk_box_pack_start (GTK_BOX (hbox), gtk_image_new_from_stock (GTK_STOCK_HELP, GTK_ICON_SIZE_BUTTON), FALSE, TRUE, 0);
	gtk_box_pack_start (GTK_BOX (hbox), dialog->history_combo, TRUE, TRUE, 0);
	gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, FALSE, TRUE, 0);
#endif
	gtk_box_pack_start (GTK_BOX (dialog->vbox), dialog->help_box, TRUE, TRUE, 0);
	gtk_box_pack_start (GTK_BOX (dialog->vbox), bottom_box, FALSE, TRUE, 0);
	gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);
	gtk_widget_show_all (dialog->vbox);

	g_signal_connect (G_OBJECT (dialog->close_button), "clicked",
	                  G_CALLBACK (close_button_clicked_cb), dialog);
	g_signal_connect (G_OBJECT (dialog), "delete-event",
	                  G_CALLBACK (gtk_widget_hide_on_delete), NULL);
}