コード例 #1
0
ファイル: GtkAssistant.c プロジェクト: cyberpython/java-gnome
JNIEXPORT jint JNICALL
Java_org_gnome_gtk_GtkAssistant_gtk_1assistant_1get_1n_1pages
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	gint result;
	jint _result;
	GtkAssistant* self;

	// convert parameter self
	self = (GtkAssistant*) _self;

	// call function
	result = gtk_assistant_get_n_pages(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jint) result;

	// and finally
	return _result;
}
コード例 #2
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
void
glade_gtk_assistant_set_property (GladeWidgetAdaptor * adaptor,
                                  GObject * object,
                                  const gchar * property_name,
                                  const GValue * value)
{
  if (strcmp (property_name, "n-pages") == 0)
    {
      GtkAssistant *assistant = GTK_ASSISTANT (object);
      gint size, i;

      for (i = gtk_assistant_get_n_pages (GTK_ASSISTANT (object)),
           size = g_value_get_int (value); i < size; i++)
	{
	  g_message ("aaaa %d %d", i,size);
        gtk_assistant_append_page (assistant, glade_placeholder_new ());
	}

      glade_gtk_assistant_update_page_type (assistant);

      return;
    }

  /* Chain Up */
  GWA_GET_CLASS (GTK_TYPE_WINDOW)->set_property (adaptor,
                                                 object, property_name, value);
}
コード例 #3
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
static gint
glade_gtk_assistant_get_page (GtkAssistant * assistant, GtkWidget * page)
{
  gint i, pages = gtk_assistant_get_n_pages (assistant);

  for (i = 0; i < pages; i++)
    if (gtk_assistant_get_nth_page (assistant, i) == page)
      return i;

  return -1;
}
コード例 #4
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
void
glade_gtk_assistant_remove_child (GladeWidgetAdaptor * adaptor,
                                  GObject * container, GObject * child)
{
  GladeWidget *gassistant = glade_widget_get_from_gobject (container);
  GtkAssistant *assistant = GTK_ASSISTANT (container);

  assistant_remove_child (assistant, GTK_WIDGET (child));

  glade_widget_property_set (gassistant, "n-pages", 
                             gtk_assistant_get_n_pages (assistant));
}
コード例 #5
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
static void
glade_gtk_assistant_update_position (GtkAssistant * assistant)
{
  gint i, pages = gtk_assistant_get_n_pages (assistant);

  for (i = 0; i < pages; i++)
    {
      GtkWidget *page = gtk_assistant_get_nth_page (assistant, i);
      GladeWidget *gpage = glade_widget_get_from_gobject (G_OBJECT (page));
      if (gpage)
        glade_widget_pack_property_set (gpage, "position", i);
    }
}
コード例 #6
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
static void
assistant_remove_child (GtkAssistant *assistant, GtkWidget *child)
{
  gint i, n = gtk_assistant_get_n_pages (assistant);

  for (i = 0; i < n; i++)
    {
      if (child == gtk_assistant_get_nth_page (assistant, i))
	{
	  gtk_assistant_remove_page (assistant, i);
	  return;
	}
    }
}
コード例 #7
0
ファイル: cong-file-new.c プロジェクト: GNOME/conglomerate
/**
 * cong_new_file_assistant_set_page:
 * @assistant:
 * @page:
 *
 * TODO: Write me
 */
void 
cong_new_file_assistant_set_page(CongNewFileAssistant *assistant, GtkWidget *page)
{
	g_return_if_fail(assistant);
	g_return_if_fail(page);

	int count;
	for(count = gtk_assistant_get_n_pages(assistant->druid); count >= 0; count--) {
		if(gtk_assistant_get_nth_page(assistant->druid, count) == page) {
			gtk_assistant_set_current_page(assistant->druid, count);
			break;
		}
	}
}
コード例 #8
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
static void
glade_gtk_assistant_parse_finished (GladeProject * project, GObject * object)
{
  GtkAssistant *assistant = GTK_ASSISTANT (object);
  gint pages = gtk_assistant_get_n_pages (assistant);

  if (pages)
    {
      /* also sets pages "complete" and thus allows navigation under glade */
      glade_gtk_assistant_update_page_type (assistant);

      gtk_assistant_set_current_page (assistant, 0);
      glade_widget_property_set (glade_widget_get_from_gobject (object),
                                 "n-pages", pages);
    }
}
コード例 #9
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
void
glade_gtk_assistant_get_property (GladeWidgetAdaptor * adaptor,
                                  GObject * object,
                                  const gchar * property_name, GValue * value)
{
  if (strcmp (property_name, "n-pages") == 0)
    {
      g_value_set_int (value,
                       gtk_assistant_get_n_pages (GTK_ASSISTANT (object)));
      return;
    }

  /* Chain Up */
  GWA_GET_CLASS (GTK_TYPE_WINDOW)->get_property (adaptor,
                                                 object, property_name, value);
}
コード例 #10
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
gboolean
glade_gtk_assistant_verify_property (GladeWidgetAdaptor * adaptor,
                                     GObject * object,
                                     const gchar * property_name,
                                     const GValue * value)
{
  if (strcmp (property_name, "n-pages") == 0)
    return g_value_get_int (value) >=
        gtk_assistant_get_n_pages (GTK_ASSISTANT (object));

  /* Chain Up */
  if (GWA_GET_CLASS (GTK_TYPE_WINDOW)->verify_property == NULL)
    return TRUE;
  return GWA_GET_CLASS (GTK_TYPE_WINDOW)->verify_property (adaptor,
                                                           object,
                                                           property_name,
                                                           value);
}
コード例 #11
0
ファイル: assistant.c プロジェクト: Pfiver/gtk
static void
on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
{
  gint current_page, n_pages;
  gchar *title;

  current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
  n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget));

  title = g_strdup_printf ("Sample assistant (%d of %d)", current_page + 1, n_pages);
  gtk_window_set_title (GTK_WINDOW (widget), title);
  g_free (title);

  /* The fourth page (counting from zero) is the progress page.  The
  * user clicked Apply to get here so we tell the assistant to commit,
  * which means the changes up to this point are permanent and cannot
  * be cancelled or revisited. */
  if (current_page == 3)
      gtk_assistant_commit (GTK_ASSISTANT (widget));
}
コード例 #12
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
GList *
glade_gtk_assistant_get_children (GladeWidgetAdaptor *adaptor,
                                  GObject *container)
{
  GtkAssistant *assist = GTK_ASSISTANT (container);
  gint i, n_pages = gtk_assistant_get_n_pages (assist);
  GList *children = NULL, *parent_children;

  /* Chain up */
  if (GWA_GET_CLASS (GTK_TYPE_WINDOW)->get_children)
    parent_children = GWA_GET_CLASS (GTK_TYPE_WINDOW)->get_children (adaptor, container);
  else
    parent_children = NULL;
  
  for (i = 0; i < n_pages; i++)
    children = g_list_prepend (children, gtk_assistant_get_nth_page (assist, i));

  children = g_list_reverse (children);

  return glade_util_purify_list (g_list_concat (children, parent_children));
}
コード例 #13
0
ファイル: assistant-window.cpp プロジェクト: GNOME/ekiga
static void
assistant_window_prepare (GtkAssistant *gtkassistant,
			  GtkWidget    *page)
{
  AssistantWindow *assistant = ASSISTANT_WINDOW (gtkassistant);
  gchar *title = NULL;
  bool forward = false;

  title = g_strdup_printf (_("Ekiga Configuration Assistant (%d of %d)"),
                           gtk_assistant_get_current_page (gtkassistant) + 1,
                           gtk_assistant_get_n_pages (gtkassistant));

  gtk_window_set_title (GTK_WINDOW (assistant), title);
  g_free (title);

  if (assistant->priv->last_active_page < gtk_assistant_get_current_page (gtkassistant))
    forward = true;
  assistant->priv->last_active_page = gtk_assistant_get_current_page (gtkassistant);

  if (!forward)
    return;

  if (page == assistant->priv->ekiga_net_page) {
    prepare_ekiga_net_page (assistant);
    return;
  }

  if (page == assistant->priv->ekiga_out_page) {
    prepare_ekiga_out_page (assistant);
    return;
  }

  if (page == assistant->priv->summary_page) {
    prepare_summary_page (assistant);
    return;
  }
}
コード例 #14
0
ファイル: glade-gtk-assistant.c プロジェクト: kugel-/glade
/*
  GtkAssistant is a very weird widget, why is it derived from GtkWindow
  instead of GtkNotebook I do not know!

  If there is no GTK_ASSISTANT_PAGE_CONFIRM, GtkAssistant abort when trying to 
  update its navigation buttons!
*/
static void
glade_gtk_assistant_update_page_type (GtkAssistant * assistant)
{
  gint i, current, pages;
  GtkWidget *page;

  current = gtk_assistant_get_current_page (assistant);
  pages = gtk_assistant_get_n_pages (assistant) - 1;
  if (pages < 0)
    return;

  /* Last Page */
  page = gtk_assistant_get_nth_page (assistant, pages);
  gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONFIRM);

  /* First page */
  page = gtk_assistant_get_nth_page (assistant, 0);
  gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_INTRO);

  /* In betwen pages */
  for (i = 1; i < pages; i++)
    {
      page = gtk_assistant_get_nth_page (assistant, i);
      gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT);
    }

  /* Now we have set page-type in every page, force button update */
  for (i = 0; i <= pages; i++)
    {
      page = gtk_assistant_get_nth_page (assistant, i);
      gtk_assistant_set_page_complete (assistant, page, TRUE);
    }

  if (current >= 0)
    gtk_assistant_set_current_page (assistant, current);
}
コード例 #15
0
ファイル: rbgtkassistant.c プロジェクト: Mazwak/ruby-gnome2
static VALUE
rg_n_pages(VALUE self)
{
    return INT2NUM(gtk_assistant_get_n_pages(_SELF(self)));
}
コード例 #16
0
ファイル: cong-file-new.c プロジェクト: GNOME/conglomerate
/**
 * new_document:
 * @parent_window:
 *
 * TODO: Write me
 */
void 
new_document(GtkWindow *parent_window)
{
	CongNewFileAssistant *assistant;

	assistant = g_new0(CongNewFileAssistant,1);

	/* FIXME:  what if no document factories found? */

	assistant->druid = GTK_ASSISTANT(gtk_assistant_new());
	gtk_widget_show (GTK_WIDGET (assistant->druid));
	g_printerr("Number of pages: %d\n", gtk_assistant_get_n_pages(assistant->druid));

	gtk_window_set_title (GTK_WINDOW (assistant->druid),
			      _("Creating a new file"));

	if (parent_window != NULL) {
		gtk_window_set_transient_for (GTK_WINDOW (assistant->druid),
					      parent_window);
	}	
	
	g_signal_connect_object (assistant->druid, "cancel",
				 G_CALLBACK (gtk_widget_destroy),
				 assistant->druid,
				 G_CONNECT_SWAPPED);
	g_signal_connect (assistant->druid, "apply",
                     G_CALLBACK (on_apply),
                     assistant);
	g_signal_connect (assistant->druid, "close",
                     G_CALLBACK (gtk_widget_destroy),
                     NULL);

	assistant->first_page = add_new_page(assistant, _("This assistant will "
		"guide you through creating a new file.\n\n"
		"Various types of file are available, and Conglomerate may be "
		"able to supply some of the \"boilerplate\" content for you.\n\n"
		"We hope that in future versions of Conglomerate you will be "
		"able to create \"template documents\" to add to this system."),
	                                     GTK_ASSISTANT_PAGE_INTRO);
	gtk_assistant_set_page_complete(assistant->druid, assistant->first_page, TRUE);

	assistant->type_selection_widget = make_type_selection_widget(assistant);
	assistant->second_page = add_new_page_with_widget(assistant,
	                                                  _("Creating a new file"),
	                                                  _("What type of file would you like to create?"),
	                                                  _("Highlight one of the items in the list and select \"Forward\" to continue"),
	                                                  assistant->type_selection_widget);
	gtk_widget_show_all(assistant->second_page);

	/* 
	   There doesn't seem to be a way to delete pages from a druid.  Hence we have to create the GUI for all of the factories
	   at the creation of the druid, rather than "on-demand".
	   FIXME: With GtkAssistant, gtk_container_remove() should work.
	 */
	assistant->hash_table_of_factory_to_page = g_hash_table_new(g_direct_hash, g_direct_equal);
	assistant->hash_table_of_factory_to_last_page = g_hash_table_new(g_direct_hash, g_direct_equal);
	assistant->hash_table_of_factory_to_data = g_hash_table_new (g_direct_hash, 
								     g_direct_equal);
	cong_plugin_manager_for_each_document_factory (cong_app_get_plugin_manager (cong_app_singleton()), 
						       add_pages_for_factory_callback, 
						       assistant);

	assistant->final_page = add_new_page(assistant, _("Conglomerate now has the "
		"information it needs to create the document.  Press \"Apply\" "
		"to create it.  You will need to save the document if you wish "
		"to keep it."), GTK_ASSISTANT_PAGE_CONFIRM);
	gtk_assistant_set_page_complete(assistant->druid, assistant->final_page, TRUE);

	gtk_assistant_set_current_page(assistant->druid, 0);
	gtk_widget_show(GTK_WIDGET(assistant->druid));

#if 0
	CONG_DO_UNIMPLEMENTED_DIALOG("The selected menu item has not yet been implemented.");
#endif

	/* FIXME:  need to sort out memory leaks */
}
コード例 #17
0
ファイル: gobject_info.c プロジェクト: samdemers/mkapp
/**
 * Print the current page and page count of an assistant.
 * @param assistant assistant to print information about
 */
void mk_print_GtkAssistant_info(GtkAssistant* assistant)
{
    gint current_page = gtk_assistant_get_current_page(assistant);
    gint n_pages = gtk_assistant_get_n_pages(assistant);
    g_printf("\t%d/%d", current_page, n_pages);
}
コード例 #18
0
ファイル: cong-file-new.c プロジェクト: GNOME/conglomerate
static void
on_type_selection_changed(GtkTreeSelection *tree_selection, CongNewFileAssistant *assistant)
{
	GtkTreeModel *tree_model;
	GtkTreeIter iter;
	int n_pages, count;

#if DEBUG_FILE_NEW_ASSISTANT
	g_message("on_type_selection_changed");
#endif
	/* Hide all factory pages (all except 0, 1 and last) */
	n_pages = gtk_assistant_get_n_pages(assistant->druid);
	for(count = 2; count < n_pages - 1; count++) {
		GtkWidget *page = gtk_assistant_get_nth_page(assistant->druid, count);
		gtk_widget_hide_all(page);
	}

	/* Get selected factory */
	if (gtk_tree_selection_get_selected (tree_selection,
                                             &tree_model,
                                             &iter) ) {
		CongServiceDocumentFactory *factory;		
		GtkWidget *appropriate_third_page, *factory_last_page;

		gtk_tree_model_get(tree_model,
				   &iter,
				   NEWDOCTYPELIST_FACTORY_COLUMN,
				   &factory,
				   -1);

		/* Find the relevant page for this factory within the druid: */
		appropriate_third_page = g_hash_table_lookup(assistant->hash_table_of_factory_to_page,
							     factory);
		factory_last_page = g_hash_table_lookup(assistant->hash_table_of_factory_to_last_page,
		                                        factory);

		if (appropriate_third_page) {
			if (appropriate_third_page == factory_last_page) {
				gtk_widget_show_all(appropriate_third_page);
			} else {
				gboolean show_page = FALSE;
				for(count = 2; count < n_pages - 1; count++) {
					GtkWidget *page = gtk_assistant_get_nth_page(assistant->druid, count);
					if(page == appropriate_third_page)
						show_page = TRUE;
					if(show_page)
						gtk_widget_show_all(page);
					if(page == factory_last_page)
						show_page = FALSE;
				}
			}
		} else {
			/* what to do in this case? */
#if DEBUG_FILE_NEW_ASSISTANT
			g_message("haven't got a third page registered for factory \"%s\"", 
				  cong_service_get_name(CONG_SERVICE(factory)));
#endif
			/* go to final page, by keeping all the in-between pages hidden */
		}

#if 0
#error		
		cong_document_factory_invoke_action_callback(factory, assistant);
#endif

		/* Allow advancing to the next page */
		gtk_assistant_set_page_complete(assistant->druid, assistant->second_page, TRUE);
	} else {
		/* Nothing selected; don't advance to the next page */
		gtk_assistant_set_page_complete(assistant->druid, assistant->second_page, FALSE);
	}

}