Ejemplo n.º 1
0
Archivo: about.c Proyecto: timxx/zenity
void 
zenity_about (ZenityData *data)
{
  GdkPixbuf *logo;
  GtkWidget *help_button;
  char *license_trans;


  translators = _("translator-credits");
  logo = gdk_pixbuf_new_from_file (ZENITY_IMAGE_FULLPATH ("zenity.png"), NULL);

  license_trans = g_strconcat (_(license[0]), "\n", _(license[1]), "\n",
                               _(license[2]), "\n", NULL);

  dialog = gtk_about_dialog_new ();

  g_object_set (G_OBJECT (dialog),
                "name", "Zenity",
                "version", VERSION,
                "copyright", "Copyright \xc2\xa9 2003 Sun Microsystems",
                "comments", _("Display dialog boxes from shell scripts"),
		"authors", authors,
                "documenters", documenters,
                "translator-credits", translators,
                "website", "http://live.gnome.org/Zenity",
                "logo", logo,
                "wrap-license", TRUE,
                "license", license_trans,
		NULL);
 
  g_free (license_trans);

  zenity_util_set_window_icon (dialog, NULL, ZENITY_IMAGE_FULLPATH ("zenity.png"));

  help_button = gtk_button_new_from_stock (GTK_STOCK_HELP);
  
  g_signal_connect (G_OBJECT (help_button), "clicked",
                    G_CALLBACK (zenity_about_display_help), data);
  
  gtk_widget_show (help_button);
  
  gtk_box_pack_end (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))),
                    help_button, FALSE, TRUE, 0);
  gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 
                                      help_button, TRUE);

  g_signal_connect (G_OBJECT (dialog), "response",
                    G_CALLBACK (zenity_about_dialog_response), data);

#if 0
  g_signal_connect (G_OBJECT (dialog), "key_press_event",
                    G_CALLBACK (zenity_zen_wisdom), NULL);
#endif

  zenity_util_show_dialog (dialog, data->attach);
  gtk_main ();
}
Ejemplo n.º 2
0
Archivo: about.c Proyecto: GNOME/zenity
void
zenity_about (ZenityData *data) {
	GdkPixbuf *logo;
	char *license_trans;

	translators = _ ("translator-credits");
	logo =
		gdk_pixbuf_new_from_file (ZENITY_IMAGE_FULLPATH ("zenity.png"), NULL);

	license_trans = g_strconcat (
		_ (license[0]), "\n", _ (license[1]), "\n", _ (license[2]), "\n", NULL);

	dialog = gtk_about_dialog_new ();

	g_object_set (G_OBJECT (dialog),
		"name",
		"Zenity",
		"version",
		VERSION,
		"copyright",
		"Copyright \xc2\xa9 2003 Sun Microsystems",
		"comments",
		_ ("Display dialog boxes from shell scripts"),
		"authors",
		authors,
		"documenters",
		documenters,
		"translator-credits",
		translators,
		"website",
		"http://live.gnome.org/Zenity",
		"logo",
		logo,
		"wrap-license",
		TRUE,
		"license",
		license_trans,
		NULL);

	g_free (license_trans);

	zenity_util_set_window_icon (
		dialog, NULL, ZENITY_IMAGE_FULLPATH ("zenity.png"));

	g_signal_connect (G_OBJECT (dialog),
		"response",
		G_CALLBACK (zenity_about_dialog_response),
		data);

#if 0
  g_signal_connect (G_OBJECT (dialog), "key_press_event",
                    G_CALLBACK (zenity_zen_wisdom), NULL);
#endif

	zenity_util_show_dialog (dialog, data->attach);
	gtk_main ();
}
Ejemplo n.º 3
0
void 
zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
{
  GtkBuilder *builder = NULL;
  GtkWidget *dialog;
  GtkWidget *button;
  GObject *text;
  GSList *entries = NULL; 
  GSList *tmp;
  GObject *vbox;
  
  builder = zenity_util_load_ui_file ("zenity_entry_dialog", NULL);

  if (builder == NULL) {
    data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
    return;
  }
	
  gtk_builder_connect_signals (builder, NULL);
	
  dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_dialog"));
	
  g_signal_connect (G_OBJECT (dialog), "response",
                    G_CALLBACK (zenity_entry_dialog_response), data);

  if (data->dialog_title)
    gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
	
  zenity_util_set_window_icon (dialog, data->window_icon, ZENITY_IMAGE_FULLPATH ("zenity-entry.png"));

  if (data->width > -1 || data->height > -1)
    gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);

  if (data->modal)
    gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
  
  if (data->ok_label) {
    button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_ok_button"));
    gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
    gtk_button_set_image (GTK_BUTTON (button),
                          gtk_image_new_from_stock (GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON));
  }

  if (data->cancel_label) {
    button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_cancel_button"));
    gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
    gtk_button_set_image (GTK_BUTTON (button),
                          gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
  }

  text = gtk_builder_get_object (builder, "zenity_entry_text");

  if (entry_data->dialog_text)
    gtk_label_set_text_with_mnemonic (GTK_LABEL (text), g_strcompress (entry_data->dialog_text));
  
  vbox = gtk_builder_get_object (builder, "vbox4");
  
  zenity_entry_fill_entries(&entries, entry_data->data);
  
  n_entries = g_slist_length (entries);

  if (n_entries > 1) {
    entry = gtk_combo_box_text_new_with_entry ();

    for (tmp = entries; tmp; tmp = tmp->next) {
      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (entry), tmp->data);
    }

    if (entry_data->entry_text) {
      gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (entry), entry_data->entry_text);
      gtk_combo_box_set_active (GTK_COMBO_BOX (entry), 0);
    }

    g_signal_connect (gtk_bin_get_child (GTK_BIN (entry)), "activate",
                      G_CALLBACK (zenity_entry_combo_activate_default),
                      GTK_WINDOW (dialog));
  } else {
    entry = gtk_entry_new();

    gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
    
    if (entry_data->entry_text)
      gtk_entry_set_text (GTK_ENTRY (entry), entry_data->entry_text);

    if (entry_data->hide_text)
      g_object_set (G_OBJECT (entry), "visibility", FALSE, NULL);
  }

  gtk_widget_show (entry);

  gtk_box_pack_end (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry);

  g_object_unref (builder);

  zenity_util_show_dialog (dialog, data->attach);

  if(data->timeout_delay > 0) {
    g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog);
  }

  gtk_main ();
}