Пример #1
0
static void
gb_gnome_druid_insert_page_before (GtkWidget * menuitem,
				   GnomeDruidPage *page)
{
  GtkWidget *parent, *new_page;
  GnomeDruidPage *prev_page;
  GList *children, *elem;

  parent = GTK_WIDGET (page)->parent;
  g_return_if_fail (GNOME_IS_DRUID (parent));

  children = gtk_container_get_children (GTK_CONTAINER (parent));
  elem = g_list_find (children, page);
  g_return_if_fail (elem != NULL);

  new_page = gb_widget_new ("GnomeDruidPageStandard", parent);
  gtk_widget_show_all (new_page);

  if (elem->prev)
    prev_page = GNOME_DRUID_PAGE (elem->prev->data);
  else
    prev_page = NULL;

  g_list_free (children);

  gnome_druid_insert_page (GNOME_DRUID (parent), prev_page,
			   GNOME_DRUID_PAGE (new_page));

  gb_gnome_druid_show_page (parent, new_page);

  gnome_druid_set_page (GNOME_DRUID (parent), GNOME_DRUID_PAGE (new_page));
  tree_add_widget (GTK_WIDGET (new_page));
}
Пример #2
0
static void
gnome_druid_cancel_callback (GtkWidget *button, GtkWidget *druid)
{
     if (GNOME_DRUID (druid)->_priv->current) {
	     if (gnome_druid_page_cancel (GNOME_DRUID (druid)->_priv->current))
		     return;

	     g_signal_emit (druid, druid_signals [CANCEL], 0);
     }
}
Пример #3
0
/*--------------------------------------------------------------------------*/
static void
prepare_finish_page( GnomeDruidPage *page, GnomeDruid *druid, gpointer data )
{

	gb_debug (DEBUG_UPDATE, "START");

	gnome_druid_set_show_finish( GNOME_DRUID(druid), TRUE );

	gnome_druid_set_buttons_sensitive( GNOME_DRUID(druid),
					   FALSE, TRUE, FALSE, FALSE );

	gb_debug (DEBUG_UPDATE, "END");
}
Пример #4
0
static void
gnome_druid_destroy (GtkObject *object)
{
	GnomeDruid *druid;

	/* remember, destroy can be run multiple times! */

	g_return_if_fail (object != NULL);
	g_return_if_fail (GNOME_IS_DRUID (object));

	druid = GNOME_DRUID (object);

	if(druid->_priv->bbox) {
		gtk_widget_destroy (druid->_priv->bbox);
		druid->_priv->bbox = NULL;
		druid->back = NULL;
		druid->next = NULL;
		druid->cancel = NULL;
		druid->finish = NULL;
		druid->help = NULL;
	}

	/* Remove all children, we set current to NULL so
	 * that the remove code doesn't try to do anything funny */
	druid->_priv->current = NULL;
	while (druid->_priv->children != NULL) {
		GnomeDruidPage *child = druid->_priv->children->data;
		gtk_container_remove (GTK_CONTAINER (druid), GTK_WIDGET(child));
	}

	GNOME_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
Пример #5
0
static void
gnome_druid_remove (GtkContainer *widget,
		    GtkWidget *child)
{
	GnomeDruid *druid;
	GList *list;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (GNOME_IS_DRUID (widget));
	g_return_if_fail (child != NULL);

	druid = GNOME_DRUID (widget);

	list = g_list_find (druid->_priv->children, child);
	/* Is it a page? */
	if (list != NULL) {
		/* If we are mapped and visible, we want to deal with changing the page. */
		if ((GTK_WIDGET_MAPPED (GTK_WIDGET (widget))) &&
		    (list->data == (gpointer) druid->_priv->current)) {
			if (list->next != NULL)
				gnome_druid_set_page (druid, GNOME_DRUID_PAGE (list->next->data));
			else if (list->prev != NULL)
				gnome_druid_set_page (druid, GNOME_DRUID_PAGE (list->prev->data));
			else
				/* Removing the only child, just set current to NULL */
				druid->_priv->current = NULL;
		}
	}
	druid->_priv->children = g_list_remove (druid->_priv->children, child);
	gtk_widget_unparent (child);
}
Пример #6
0
/*--------------------------------------------------------------------------*/
static void
no_download( void )
{
	gchar *date_min, *date_max, *finish_msg;
	gbTableModel     *table_model;

	gb_debug (DEBUG_UPDATE, "START");

	/* customize finish page for this outcome */
	gnome_druid_page_edge_set_title( GNOME_DRUID_PAGE_EDGE(finish_page),
					 _( "No new data available" ) );
	table_model = gb_table_get_model ();
	date_min = gb_date_fmt (gb_table_model_get_rdate_min (table_model));
	date_max = gb_date_fmt (gb_table_model_get_rdate_max (table_model));
	finish_msg = g_strdup_printf(
		_( "No new redemption data available from selected\n"
		   "download site.\n\n"
		   "GBonds is still configured with redemption data\n"
		   "for %s - %s.\n" ),
		date_min, date_max );
	gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE(finish_page), finish_msg );
	g_free( date_min );
	g_free( date_max );
	g_free( finish_msg );

	remote_dir_handle = NULL;

	/* Now jump to the finish page */
	gnome_druid_set_page( GNOME_DRUID(update_druid),
			      GNOME_DRUID_PAGE(finish_page) );

	gb_debug (DEBUG_UPDATE, "END");
}
Пример #7
0
static AtkObject *
gnome_druid_accessible_ref_child (AtkObject *accessible,
                                  gint       index)
{
	GnomeDruid *druid;
	GtkWidget *widget;
	GList *children;
	GList *tmp_list;
	GtkWidget *child;
	AtkObject *obj;

	widget = GTK_ACCESSIBLE (accessible)->widget;
	if (!widget)
		return NULL;
	
	if (index < 0)
		return NULL;
	druid = GNOME_DRUID (widget);
	children = druid->_priv->children;
	if (index < g_list_length (children)) {
		tmp_list = g_list_nth (children, index);
		child = tmp_list->data;
	} else if (index == g_list_length (children)) {
		child = druid->_priv->bbox;
	} else {
		return NULL;
	}
	obj = gtk_widget_get_accessible (child);
	g_object_ref (obj);
	return obj;
}
Пример #8
0
/**
 * gnome_druid_new_with_window:
 * @title: A title of the window.
 * @parent: The parent of this window (transient_for).
 * @close_on_cancel: %TRUE if the window should be closed when cancel is
 * pressed.
 * @window: Optional return of the #GtkWindow created.
 *
 * Description: Creates a new #GnomeDruid widget. It also creates a new
 * toplevel window with the title of @title (which can be %NULL) and a parent
 * of @parent (which also can be %NULL). The window and the druid will both be
 * shown.  If you need the window widget pointer you can optionally get it
 * through the last argument.  When the druid gets destroyed, so will the
 * window that is created here.
 *
 * Returns:  A new #GnomeDruid widget.
 **/
GtkWidget *
gnome_druid_new_with_window (const char *title,
			     GtkWindow *parent,
			     gboolean close_on_cancel,
			     GtkWidget **window)
{
	GtkWidget *druid = g_object_new (GNOME_TYPE_DRUID, NULL);

	/* make sure we always set window to NULL, even in
	 * case of precondition errors */
	if (window != NULL)
		*window = NULL;

	g_return_val_if_fail (parent == NULL ||
			      GTK_IS_WINDOW (parent),
			      NULL);

	gnome_druid_construct_with_window (GNOME_DRUID (druid),
					   title,
					   parent,
					   close_on_cancel,
					   window);

	return druid;
}
Пример #9
0
void
gb_gnome_druid_add_child (GtkWidget *widget,
			  GtkWidget *child,
			  GbWidgetSetArgData *data)
{
  gnome_druid_append_page (GNOME_DRUID (widget), GNOME_DRUID_PAGE (child));
}
Пример #10
0
static void
gnome_druid_forall (GtkContainer *container,
		    gboolean      include_internals,
		    GtkCallback   callback,
		    gpointer      callback_data)
{
	GnomeDruid *druid;
	GnomeDruidPage *child;
	GList *children;

	g_return_if_fail (container != NULL);
	g_return_if_fail (GNOME_IS_DRUID (container));
	g_return_if_fail (callback != NULL);

	druid = GNOME_DRUID (container);

	children = druid->_priv->children;
	while (children) {
		child = children->data;
		children = children->next;

		(* callback) (GTK_WIDGET (child), callback_data);
	}
	if (include_internals) {
		/* FIXME: should this be gtk_contianer_forall() ? */
		(* callback) (druid->_priv->bbox, callback_data);
#if 0
		(* callback) (druid->back, callback_data);
		(* callback) (druid->next, callback_data);
		(* callback) (druid->cancel, callback_data);
		(* callback) (druid->finish, callback_data);
		(* callback) (druid->help, callback_data);
#endif
	}
}
Пример #11
0
static void
druid_disable_next_button(ABInitialInfo *info)
{
    g_return_if_fail(info);
    gnome_druid_set_buttons_sensitive(GNOME_DRUID(info->druid),
                                      TRUE, FALSE, TRUE, TRUE);
}
Пример #12
0
static void
gnome_druid_unmap (GtkWidget *widget)
{
	GnomeDruid *druid;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (GNOME_IS_DRUID (widget));

	druid = GNOME_DRUID (widget);
	GTK_WIDGET_UNSET_FLAGS (druid, GTK_MAPPED);
#if 0
	gtk_widget_unmap (druid->back);
	if (druid->_priv->show_finish)
		gtk_widget_unmap (druid->finish);
	else
		gtk_widget_unmap (druid->next);
	gtk_widget_unmap (druid->cancel);
	if (druid->_priv->show_help)
		gtk_widget_unmap (druid->help);
#endif
	gtk_widget_unmap (druid->_priv->bbox);
	if (druid->_priv->current &&
	    GTK_WIDGET_VISIBLE (druid->_priv->current) &&
	    GTK_WIDGET_MAPPED (druid->_priv->current))
		gtk_widget_unmap (GTK_WIDGET (druid->_priv->current));
}
Пример #13
0
static void
gnome_druid_set_property (GObject      *object,
			  guint         prop_id,
			  const GValue *value,
			  GParamSpec   *pspec)
{
  switch (prop_id)
    {
    case PROP_SHOW_FINISH:
      gnome_druid_set_show_finish (GNOME_DRUID (object), g_value_get_boolean (value));
      break;
    case PROP_SHOW_HELP:
      gnome_druid_set_show_help (GNOME_DRUID (object), g_value_get_boolean (value));
      break;
    default:
      break;
    }
}
Пример #14
0
static void
on_druid_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
{
  GtkWidget *new_widget, *spinbutton, *window, *page;
  gint pages, i;

  window = gtk_widget_get_toplevel (widget);

  /* Only call callback if placeholder/fixed widget is still there */
  if (gb_widget_can_finish_new (data))
    {
      spinbutton = gtk_object_get_data (GTK_OBJECT (window), "pages");
      g_return_if_fail (spinbutton != NULL);
      pages = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));

      new_widget = gnome_druid_new ();
      page = gnome_druid_page_edge_new_aa (GNOME_EDGE_START);
      gb_widget_create_from (page, "GnomeDruidPageStart");
      gnome_druid_append_page (GNOME_DRUID (new_widget),
			       GNOME_DRUID_PAGE (page));
      gnome_druid_set_page (GNOME_DRUID (new_widget), GNOME_DRUID_PAGE (page));

      for (i = 0; i < pages - 2; i++)
	{
	  page = gb_widget_new ("GnomeDruidPageStandard", new_widget);
	  gnome_druid_append_page (GNOME_DRUID (new_widget),
				   GNOME_DRUID_PAGE (page));
	}

      if (pages >= 2)
	{
	  page = gnome_druid_page_edge_new_aa (GNOME_EDGE_FINISH);
	  gb_widget_create_from (page, "GnomeDruidPageFinish");
	  gnome_druid_append_page (GNOME_DRUID (new_widget),
				   GNOME_DRUID_PAGE (page));
	}

      gtk_widget_show_all (new_widget);
      gb_widget_initialize (new_widget, data);
      (*data->callback) (new_widget, data);
    }
  gtk_widget_destroy (window);
}
Пример #15
0
static void
gnome_druid_get_property (GObject    *object,
			  guint       prop_id,
			  GValue     *value,
			  GParamSpec *pspec)
{
	switch (prop_id)
	{
	case PROP_SHOW_FINISH:
		g_value_set_boolean (value, GNOME_DRUID (object)->_priv->show_finish);
		break;
	case PROP_SHOW_HELP:
		g_value_set_boolean (value, GNOME_DRUID (object)->_priv->show_help);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
Пример #16
0
static void
gnome_druid_add (GtkContainer *widget,
		 GtkWidget *page)
{
	g_return_if_fail (widget != NULL);
	g_return_if_fail (GNOME_IS_DRUID (widget));
	g_return_if_fail (page != NULL);
	g_return_if_fail (GNOME_IS_DRUID_PAGE (page));

	gnome_druid_append_page (GNOME_DRUID (widget), GNOME_DRUID_PAGE (page));
}
Пример #17
0
static void
gb_gnome_druid_insert_page_after (GtkWidget * menuitem,
				  GnomeDruidPage *page)
{
  GtkWidget *parent, *new_page;

  parent = GTK_WIDGET (page)->parent;
  g_return_if_fail (GNOME_IS_DRUID (parent));

  new_page = gb_widget_new ("GnomeDruidPageStandard", parent);
  gtk_widget_show_all (new_page);

  gnome_druid_insert_page (GNOME_DRUID (parent),
			   GNOME_DRUID_PAGE (page),
			   GNOME_DRUID_PAGE (new_page));

  gb_gnome_druid_show_page (parent, new_page);

  gnome_druid_set_page (GNOME_DRUID (parent), GNOME_DRUID_PAGE (new_page));
  tree_add_widget (GTK_WIDGET (new_page));
}
gboolean
on_ContactsImport_activate (GtkWidget * widget, GdkEvent * event, gpointer user_data)
{
	GnomeDruid *druid;
	gladexml_import_userlist = glade_xml_new (PACKAGE_DATA_DIR "/gnomegadu.glade", "ImportUserlist", NULL);

	druid = GNOME_DRUID (glade_xml_get_widget (gladexml_import_userlist, "ImportUserlistDruid"));

	gnome_druid_set_buttons_sensitive (druid, FALSE, TRUE, TRUE, FALSE);
	glade_xml_signal_autoconnect (gladexml_import_userlist);
	gtk_widget_show_all (GTK_WIDGET (druid));
	return TRUE;
}
Пример #19
0
/*--------------------------------------------------------------------------*/
void
gb_update_druid (void)
{
	GdkPixbuf *logo;

	gb_debug (DEBUG_UPDATE, "START");

	if ( update_window == NULL ) {
		
		remote_dir_handle = NULL;
		remote_file_handle = NULL;
		update_cancel_flag = FALSE;

		logo = gdk_pixbuf_new_from_file (ICON_PIXMAP, NULL);

		update_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
		gtk_window_set_default_size (GTK_WINDOW(update_window),
					     DRUID_WIDTH, DRUID_HEIGHT);
		update_druid = gnome_druid_new();
		gtk_container_add( GTK_CONTAINER(update_window), update_druid );

		add_start_page( GNOME_DRUID(update_druid), logo );
		add_select_download_page( GNOME_DRUID(update_druid), logo );
		add_downloading_page( GNOME_DRUID(update_druid), logo );
		add_finish_page( GNOME_DRUID(update_druid), logo );
		
		g_signal_connect( G_OBJECT(update_druid), "cancel",
				  G_CALLBACK(cancel_cb), NULL );

		g_signal_connect( G_OBJECT(update_window), "destroy",
				  G_CALLBACK(destroy_cb), NULL );

		gtk_widget_show_all( update_window );
	}

	gb_debug (DEBUG_UPDATE, "END");

}
Пример #20
0
static int
gnome_druid_accessible_get_n_children (AtkObject *accessible)
{
	GnomeDruid *druid;
	GtkWidget *widget;

	widget = GTK_ACCESSIBLE (accessible)->widget;
	if (!widget)
		return 0;

	druid = GNOME_DRUID (widget);

	return g_list_length (druid->_priv->children) + 1;
}
Пример #21
0
static void
gnome_druid_finalize (GObject *object)
{
	GnomeDruid *druid;

	g_return_if_fail (object != NULL);
	g_return_if_fail (GNOME_IS_DRUID (object));

	druid = GNOME_DRUID (object);

	g_free(druid->_priv);
	druid->_priv = NULL;

	GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
gboolean
on_userlist_import_page_1_next (GnomeDruidPage * druidpage, GtkWidget * widget, gpointer user_data)
{
	GtkWidget *radio_import_server, *radio_import_file;
	GnomeDruid *druid = GNOME_DRUID (glade_xml_get_widget (gladexml_import_userlist, "ImportUserlistDruid"));
	GnomeDruidPage *page_last = GNOME_DRUID_PAGE (glade_xml_get_widget (gladexml_import_userlist, "userlist_import_page_last"));

	radio_import_server = glade_xml_get_widget (gladexml_import_userlist, "RadioImportServer");
	radio_import_file = glade_xml_get_widget (gladexml_import_userlist, "RadioImportFile");
	g_assert (radio_import_file);

	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_import_server)))
	{
		GtkWidget *progress_window;

		if (!gnomegadu_gadugadu_session)
		{
			GtkDialog *msgdialog = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
										   "<span weight=\"bold\"size=\"larger\">Brak połączenia</span>\n\nPołącz się z siecią Gadu-Gadu i spróbuj ponownie.");
			gtk_dialog_run (GTK_DIALOG (msgdialog));
			gtk_widget_destroy (GTK_WIDGET (msgdialog));
			return TRUE;
		}

		gladexml_import_userlist_progress = glade_xml_new (PACKAGE_DATA_DIR "/gnomegadu.glade", "ImportUserlistServerProgressWindow", NULL);
		glade_xml_signal_autoconnect (gladexml_import_userlist_progress);

		g_assert (gladexml_import_userlist_progress);

		progress_window = glade_xml_get_widget (gladexml_import_userlist_progress, "ImportUserlistServerProgressWindow");
		g_assert(progress_window);
		gtk_widget_show_all (GTK_WIDGET(progress_window));

		gg_userlist_request (gnomegadu_gadugadu_session, GG_USERLIST_GET, NULL);

		gnome_druid_set_page (druid, page_last);
		gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, FALSE);
		gnome_druid_set_show_finish (druid, TRUE);
	}
	else
	{
		//gtk_file_chooser_get_filename ()
		//gnomegadu_import_userlist_from_file();
	}
	return FALSE;
}
gboolean
on_userlist_import_page_last_back (GnomeDruidPage * druidpage, GtkWidget * widget, gpointer user_data)
{
	GtkWidget *radio_import_server, *radio_import_file;
	GnomeDruid *druid = GNOME_DRUID (glade_xml_get_widget (gladexml_import_userlist, "ImportUserlistDruid"));
	GnomeDruidPage *page1 = GNOME_DRUID_PAGE (glade_xml_get_widget (gladexml_import_userlist, "userlist_import_page_1"));

	radio_import_server = glade_xml_get_widget (gladexml_import_userlist, "RadioImportServer");
	radio_import_file = glade_xml_get_widget (gladexml_import_userlist, "RadioImportFile");

	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_import_server)))
	{
		gnome_druid_set_page (druid, page1);
		return TRUE;
	}

	return FALSE;
}
Пример #24
0
static gint
gnome_druid_expose (GtkWidget      *widget,
		    GdkEventExpose *event)
{
	GnomeDruid *druid;
	GtkWidget *child;
	GList *children;

	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (GNOME_IS_DRUID (widget), FALSE);
	g_return_val_if_fail (event != NULL, FALSE);

	if (GTK_WIDGET_DRAWABLE (widget)) {
		druid = GNOME_DRUID (widget);
		children = druid->_priv->children;

		while (children) {
			child = GTK_WIDGET (children->data);
			children = children->next;

			gtk_container_propagate_expose (GTK_CONTAINER (widget),
							child, event);
		}
		gtk_container_propagate_expose (GTK_CONTAINER (widget),
						druid->_priv->bbox, event);
#if 0
		gtk_container_propagate_expose (GTK_CONTAINER (widget),
						druid->back, event);
		gtk_container_propagate_expose (GTK_CONTAINER (widget),
						druid->next, event);
		gtk_container_propagate_expose (GTK_CONTAINER (widget),
						druid->cancel, event);
		gtk_container_propagate_expose (GTK_CONTAINER (widget),
						druid->finish, event);
		gtk_container_propagate_expose (GTK_CONTAINER (widget),
						druid->help, event);
#endif
	}
	return FALSE;
}
Пример #25
0
void
dai_match_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget,
                          gpointer user_data)
{
    ABInitialInfo *info = user_data;
    Account *root;
    AccCbData data;

    g_return_if_fail(info && info->api);

    /* No way back */
    gnome_druid_set_buttons_sensitive(GNOME_DRUID(info->druid),
                                      FALSE, TRUE, TRUE, TRUE);

    /* Do not run this twice */
    if (info->match_page_prepared)
        return;
    else
        info->match_page_prepared = TRUE;

    /* Load aqbanking accounts */
#ifdef AQBANKING_VERSION_4_PLUS
    AB_Banking_OnlineInit(info->api, 0);
#else
    AB_Banking_OnlineInit(info->api);
#endif

    /* Determine current mapping */
    root = gnc_book_get_root_account(gnc_get_current_book());
    info->gnc_hash = g_hash_table_new(&g_direct_hash, &g_direct_equal);
    data.api = info->api;
    data.hash = info->gnc_hash;
    gnc_account_foreach_descendant(
        root, (AccountCb) hash_from_kvp_acc_cb, &data);

    /* Update the graphical representation */
    update_account_list(info);
}
Пример #26
0
/*
 * Adds menu items to a context menu which is just about to appear!
 * Add commands to aid in editing a GnomeDruid, with signals pointing to
 * other functions in this file.
 */
static void
gb_gnome_druid_create_popup_menu (GtkWidget * widget,
				  GbWidgetCreateMenuData * data)
{
  GtkWidget *menuitem;
  GnomeDruid *druid;
  GList *children, *elem;

  if (data->child == NULL)
    return;

  g_return_if_fail (GNOME_IS_DRUID (data->child->parent));
  druid = GNOME_DRUID (data->child->parent);

  children = gtk_container_get_children (GTK_CONTAINER (widget));

  /* 'Add Start Page' is added if the druid has no pages or the first one
     is not a start page. */
  if (!children ||
      !(GNOME_IS_DRUID_PAGE_EDGE (children->data) &&
	GNOME_DRUID_PAGE_EDGE (children->data)->position == GNOME_EDGE_START))
    {
      menuitem = gtk_menu_item_new_with_label (_("Add Start Page"));
      gtk_widget_show (menuitem);
      gtk_menu_append (GTK_MENU (data->menu), menuitem);
      gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
			  GTK_SIGNAL_FUNC (gb_gnome_druid_add_start_page),
			  druid);
    }

  /* 'Add Finish Page' is added if the druid has no pages or the last one
     is not a finish page. */
  elem = g_list_last (children);
  if (!elem ||
      !(GNOME_IS_DRUID_PAGE_EDGE (elem->data) &&
	GNOME_DRUID_PAGE_EDGE (elem->data)->position == GNOME_EDGE_FINISH))
    {
      menuitem = gtk_menu_item_new_with_label (_("Add Finish Page"));
      gtk_widget_show (menuitem);
      gtk_menu_append (GTK_MENU (data->menu), menuitem);
      gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
			  GTK_SIGNAL_FUNC (gb_gnome_druid_add_finish_page),
			  druid);
    }

  g_list_free (children);

  /* 'Insert Page Before' is added if the current page is not the start page.
   */
  if (!(GNOME_IS_DRUID_PAGE_EDGE (data->child) &&
	GNOME_DRUID_PAGE_EDGE (data->child)->position == GNOME_EDGE_START))
    {
      menuitem = gtk_menu_item_new_with_label (_("Insert Page Before"));
      gtk_widget_show (menuitem);
      gtk_menu_append (GTK_MENU (data->menu), menuitem);
      gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
			  GTK_SIGNAL_FUNC (gb_gnome_druid_insert_page_before),
			  data->child);
    }

  /* 'Insert Page After' is added if the current page is not the finish page.
   */
  if (!(GNOME_IS_DRUID_PAGE_EDGE (data->child) &&
	GNOME_DRUID_PAGE_EDGE (data->child)->position == GNOME_EDGE_FINISH))
    {
      menuitem = gtk_menu_item_new_with_label (_("Insert Page After"));
      gtk_widget_show (menuitem);
      gtk_menu_append (GTK_MENU (data->menu), menuitem);
      gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
			  GTK_SIGNAL_FUNC (gb_gnome_druid_insert_page_after),
			  data->child);
    }
}
Пример #27
0
Файл: at_new.c Проект: piki/gat
at_job_t *make_new_at_job() {
  GtkWidget *druid, *page_start, *page_at1, *page_at2, *page_finish;
  GtkWidget *hbox, *frame, *align, *bigvbox;
  at_druid_info *info;
  struct tm *tp;
  time_t t;
  char *fname;
  GdkPixbuf *logo = NULL;

  fname = gnome_pixmap_file("gnome-clock.png");
  if (fname)
    logo = gdk_pixbuf_new_from_file(fname, NULL);
  g_free(fname);

  time(&t);
  tp = localtime(&t);

  info = g_new(at_druid_info, 1);
  druid = gnome_druid_new_with_window("New One-Time Job",
    NULL, TRUE, &info->win);

  page_start = gnome_druid_page_edge_new_with_vals(
    GNOME_EDGE_START, FALSE,
    "Create new one-time job",
    "This series of dialogs will step\n"
    "you through the process of creating\n"
    "a new one-time job.", logo, NULL, NULL);
  page_at1 = gnome_druid_page_standard_new_with_vals(
    "Choose a time and date", logo, NULL);
  page_at2 = gnome_druid_page_standard_new_with_vals(
    "Select command", logo, NULL);
  page_finish = gnome_druid_page_edge_new_with_vals(
    GNOME_EDGE_FINISH, FALSE,
    "Confirm new job", NULL, logo, NULL, NULL);

  bigvbox = gtk_vbox_new(FALSE, 0);
  align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
  gtk_container_add(GTK_CONTAINER(align), bigvbox);
  gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(page_at1)->vbox),
    align, TRUE, TRUE, 0);

  info->cal = gtk_calendar_new();
  gtk_box_pack_start(GTK_BOX(bigvbox), info->cal, FALSE, FALSE, 0);

  hbox = gtk_hbox_new(FALSE, 0);
  frame = gtk_frame_new("Time");
  gtk_container_set_border_width(GTK_CONTAINER(frame), 8);
  gtk_box_pack_start(GTK_BOX(bigvbox), frame, FALSE, FALSE, 0);
  gtk_container_add(GTK_CONTAINER(frame), hbox);

  info->hour = make_new_spinner("Hour:", tp->tm_hour, 0, 23, 5, hbox);
  info->minute = make_new_spinner("Minute:", tp->tm_min, 0, 59, 5, hbox);

  info->command = make_job_page(GNOME_DRUID_PAGE_STANDARD(page_at2)->vbox);

  gtk_signal_connect_object(GTK_OBJECT(page_finish), "finish",
    GTK_SIGNAL_FUNC(at_commit_job), (gpointer)info);
  gtk_signal_connect_object(GTK_OBJECT(info->win), "destroy",
    GTK_SIGNAL_FUNC(g_free), (gpointer)info);
  gtk_signal_connect(GTK_OBJECT(page_finish), "prepare",
    GTK_SIGNAL_FUNC(prepare_last_page), (gpointer)info);
  gtk_signal_connect(GTK_OBJECT(info->command), "changed",
    GTK_SIGNAL_FUNC(cmd_changed), (gpointer)druid);

  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_start));
  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_at1));
  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_at2));
  gnome_druid_append_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_finish));
  gnome_druid_set_page(GNOME_DRUID(druid), GNOME_DRUID_PAGE(page_start));
  gtk_window_set_modal(GTK_WINDOW(info->win), TRUE);
  gtk_widget_show_all(info->win);

  g_object_unref(logo);

  return NULL;
}
Пример #28
0
/*--------------------------------------------------------------------------*/
static void
download_done( DownloadCallbackData *data )
{
	GList            *p;
	GnomeVFSFileInfo *info, tmp_info = {0};
	gchar            *hash_name;
	gchar            *hash_path, *hash_text_uri;
	gchar            *file_path, *file_text_uri;
	gchar            *date_min, *date_max, *finish_msg;
	gchar            *data_dir;
	gbTableModel     *table_model;

	gb_debug (DEBUG_UPDATE, "START");

	/* Rename downloaded files (undo name hash) */
	data_dir = gb_util_get_home_data_dir();
	for ( p=data->list; p != NULL; p=p->next ) {
		info = (GnomeVFSFileInfo *)p->data;
		hash_name = hash_filename( info->name );
		hash_path = g_build_filename( data_dir, hash_name, NULL );
		hash_text_uri = gnome_vfs_get_uri_from_local_path( hash_path );
		file_path = g_build_filename( data_dir, info->name, NULL );
		file_text_uri = gnome_vfs_get_uri_from_local_path( file_path );
		gnome_vfs_get_file_info (hash_text_uri, &tmp_info, GNOME_VFS_FILE_INFO_DEFAULT);
		if ( info->size == tmp_info.size ) {
			gnome_vfs_move( hash_text_uri, file_text_uri, FALSE );
		} else {
			g_warning ("%s: Temporary file size (%"
				   GNOME_VFS_OFFSET_FORMAT_STR
				   ") does not match remote size (%"
				   GNOME_VFS_OFFSET_FORMAT_STR
				   ").",
				   info->name, tmp_info.size, info->size);
			gnome_vfs_unlink (hash_text_uri);
		}
		g_free( hash_name );
		g_free( hash_path );
		g_free( hash_text_uri );
		g_free( file_path );
		g_free( file_text_uri );
	}
	g_free( data_dir );

	/* Now reread redemption tables */
	table_model = gb_table_get_model ();
	gb_table_model_update (table_model);

	/* customize finish page for this outcome */
	gnome_druid_page_edge_set_title( GNOME_DRUID_PAGE_EDGE(finish_page),
					 _( "Download done" ) );
	date_min = gb_date_fmt (gb_table_model_get_rdate_min (table_model));
	date_max = gb_date_fmt (gb_table_model_get_rdate_max (table_model));
	finish_msg = g_strdup_printf(
		_( "GBonds has successfully downloaded "
		   "%d new redemption files.\n\n"
		   "GBonds is now configured with redemption data\n"
		   "for %s - %s.\n" ),
		data->n, date_min, date_max );
	gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE(finish_page), finish_msg );
	g_free( date_min );
	g_free( date_max );
	g_free( finish_msg );

	remote_dir_handle = NULL;

	/* Now jump to the finish page */
	gnome_druid_set_page( GNOME_DRUID(update_druid),
			      GNOME_DRUID_PAGE(finish_page) );

	gb_debug (DEBUG_UPDATE, "END");
}
Пример #29
0
static void
ap_druid_create (AcctPeriodInfo *info)
{
    GladeXML *xml;
    GtkWidget *w;

    xml = gnc_glade_xml_new ("acctperiod.glade", "Acct Period Druid");

    info->window = glade_xml_get_widget (xml, "Acct Period Druid");

    info->druid = GNOME_DRUID (glade_xml_get_widget (xml, "acct_period_druid"));
    gnc_druid_set_colors (info->druid);

    info->start_page =
        GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "start page"));
    info->menu_page =
        GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "menu page"));
    info->book_page =
        GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "book page"));
    info->finish_page =
        GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "finish page"));

    info->close_status = -1;

    /* Find the date of the earliest transaction in the book.
     * Add a year minus a day as the first guess for book closing,
     * and use that to set up the freq spec widget. */
    info->earliest = get_earliest_in_book (gnc_get_current_book());
    info->earliest_str = qof_print_date(info->earliest);
    PINFO ("date of earliest transaction is %ld %s",
           info->earliest, ctime (&info->earliest));

    g_date_clear (&info->closing_date, 1);
    g_date_set_time_t (&info->closing_date, info->earliest);
    g_date_clear (&info->prev_closing_date, 1);
    info->prev_closing_date = info->closing_date;
    g_date_add_years (&info->closing_date, 1);

    {
        Recurrence *r = g_new0(Recurrence, 1);
        recurrenceSet(r, 1, PERIOD_MONTH, &info->closing_date, WEEKEND_ADJ_NONE);
        info->period = NULL;
        info->period = g_list_append(info->period, r);
    }

    info->period_menu = GNC_FREQUENCY(
                            gnc_frequency_new_from_recurrence(info->period, &info->closing_date));

    /* Change the text so that its more mainingful for this druid */
    gnc_frequency_set_frequency_label_text(info->period_menu, _("Period:"));
    gnc_frequency_set_date_label_text(info->period_menu, _("Closing Date:"));

    /* Reparent to the correct location */
    w = glade_xml_get_widget (xml, "period box");
    gtk_box_pack_start (GTK_BOX (w), GTK_WIDGET (info->period_menu),
                        TRUE, TRUE, 0);

    /* Get handles to all of the other widgets we'll need */
    info->period_remarks =
        GTK_LABEL (glade_xml_get_widget (xml, "remarks label"));

    info->close_results =
        GTK_LABEL (glade_xml_get_widget (xml, "results label"));

    info->book_details =
        GTK_LABEL (glade_xml_get_widget (xml, "book label"));

    info->book_title =
        GTK_ENTRY (glade_xml_get_widget (xml, "book title entry"));

    info->book_notes =
        GTK_TEXT_VIEW (glade_xml_get_widget (xml, "book notes text"));

    /* generic finished/close/abort signals */
    g_signal_connect (info->window, "destroy",
                      G_CALLBACK (ap_window_destroy_cb), info);

    g_signal_connect (info->druid, "cancel",
                      G_CALLBACK (ap_druid_cancel), info);

    g_signal_connect (info->menu_page, "prepare",
                      G_CALLBACK (ap_show_menu), info);

    g_signal_connect (info->menu_page, "next",
                      G_CALLBACK (ap_validate_menu), info);

    g_signal_connect (info->book_page, "prepare",
                      G_CALLBACK (ap_show_book), info);

    g_signal_connect (info->book_page, "next",
                      G_CALLBACK (ap_close_period), info);

    g_signal_connect (info->finish_page, "prepare",
                      G_CALLBACK (ap_show_done), info);

    g_signal_connect (info->finish_page, "finish",
                      G_CALLBACK (ap_finish), info);

    /* User changes the accouting period or date signals */
    g_signal_connect (info->period_menu, "changed",
                      G_CALLBACK (ap_changed), info);
}
Пример #30
0
void
gnc_ab_initial_druid(void)
{
    ABInitialInfo *info;
    GladeXML *xml;
    GtkTreeViewColumn *column;
    GtkTreeSelection *selection;
    gint component_id;

    info = g_new0(ABInitialInfo, 1);

    xml = gnc_glade_xml_new("aqbanking.glade", "AqBanking Init Druid");

    info->window = glade_xml_get_widget(xml, "AqBanking Init Druid");
    g_object_set_data_full(G_OBJECT(info->window), "xml", xml, g_object_unref);
    glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
                                      info);

    info->druid = glade_xml_get_widget(xml, "ab_init_druid");
    gnc_druid_set_colors(GNOME_DRUID(info->druid));

    info->api = gnc_AB_BANKING_new();
    info->deferred_info = NULL;
    info->gnc_hash = NULL;

    info->match_page_prepared = FALSE;
    info->account_view =
        GTK_TREE_VIEW(glade_xml_get_widget(xml, "account_page_view"));
    info->account_store = gtk_list_store_new(NUM_ACCOUNT_LIST_COLS,
                          G_TYPE_INT, G_TYPE_STRING,
                          G_TYPE_POINTER, G_TYPE_STRING,
                          G_TYPE_BOOLEAN);
    gtk_tree_view_set_model(info->account_view,
                            GTK_TREE_MODEL(info->account_store));
    g_object_unref(info->account_store);

    column = gtk_tree_view_column_new_with_attributes(
                 _("Online Banking Account Name"), gtk_cell_renderer_text_new(),
                 "text", ACCOUNT_LIST_COL_AB_NAME, (gchar*) NULL);
    gtk_tree_view_append_column(info->account_view, column);

    column = gtk_tree_view_column_new_with_attributes(
                 _("GnuCash Account Name"), gtk_cell_renderer_text_new(),
                 "text", ACCOUNT_LIST_COL_GNC_NAME, (gchar*) NULL);
    gtk_tree_view_column_set_expand(column, TRUE);
    gtk_tree_view_append_column(info->account_view, column);

    column = gtk_tree_view_column_new_with_attributes(
                 _("New?"), gtk_cell_renderer_toggle_new(),
                 "active", ACCOUNT_LIST_COL_CHECKED, (gchar*) NULL);
    gtk_tree_view_append_column(info->account_view, column);

    selection = gtk_tree_view_get_selection(info->account_view);
    g_signal_connect(selection, "changed",
                     G_CALLBACK(account_list_changed_cb), info);

    component_id = gnc_register_gui_component(DRUID_AB_INITIAL_CM_CLASS,
                   NULL, cm_close_handler, info);
    gnc_gui_component_set_session(component_id, gnc_get_current_session());

    gtk_widget_show(info->window);
}