/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * * This library is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <string.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> #include <glib/gi18n-lib.h> #include <libedataserver/libedataserver.h> #include "e-categories-dialog.h" #include "e-categories-editor.h" #include "e-categories-selector.h" #include "e-category-completion.h" #include "e-category-editor.h" #define E_CATEGORIES_DIALOG_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_CATEGORIES_DIALOG, ECategoriesDialogPrivate)) G_DEFINE_TYPE (ECategoriesDialog, e_categories_dialog, GTK_TYPE_DIALOG) struct _ECategoriesDialogPrivate { GtkWidget *categories_editor; }; static void entry_changed_cb (GtkEntry *entry, ECategoriesDialog *dialog) { gtk_dialog_set_response_sensitive ( GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE); } static void e_categories_dialog_class_init (ECategoriesDialogClass *class) { g_type_class_add_private (class, sizeof (ECategoriesDialogPrivate)); } static void e_categories_dialog_init (ECategoriesDialog *dialog) { GtkWidget *dialog_content; GtkWidget *categories_editor; dialog->priv = E_CATEGORIES_DIALOG_GET_PRIVATE (dialog); categories_editor = e_categories_editor_new (); dialog->priv->categories_editor = categories_editor; dialog_content = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_container_set_border_width (GTK_CONTAINER (dialog), 12); gtk_box_pack_start ( GTK_BOX (dialog_content), categories_editor, TRUE, TRUE, 0); gtk_box_set_spacing (GTK_BOX (dialog_content), 12); g_signal_connect ( categories_editor, "entry-changed", G_CALLBACK (entry_changed_cb), dialog); gtk_dialog_add_buttons ( GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_set_response_sensitive ( GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); gtk_window_set_title (GTK_WINDOW (dialog), _("Categories")); gtk_widget_show_all (categories_editor); } /** * e_categories_dialog_new: * @categories: Comma-separated list of categories * * Creates a new #ECategoriesDialog widget and sets the initial selection * to @categories. * * Returns: a new #ECategoriesDialog **/ GtkWidget * e_categories_dialog_new (const gchar *categories) { ECategoriesDialog *dialog; dialog = g_object_new (E_TYPE_CATEGORIES_DIALOG, NULL); if (categories) e_categories_dialog_set_categories (dialog, categories); return GTK_WIDGET (dialog); } /** * e_categories_dialog_get_categories: * @dialog: An #ECategoriesDialog * * Gets a comma-separated list of the categories currently selected * in the dialog. * * Returns: a comma-separated list of categories. Free returned * pointer with g_free(). **/ gchar * e_categories_dialog_get_categories (ECategoriesDialog *dialog) { gchar *categories; g_return_val_if_fail (E_IS_CATEGORIES_DIALOG (dialog), NULL); categories = e_categories_editor_get_categories ( E_CATEGORIES_EDITOR (dialog->priv->categories_editor)); return categories; } /** * e_categories_dialog_set_categories: * @dialog: An #ECategoriesDialog * @categories: Comma-separated list of categories * * Sets the list of categories selected on the dialog. **/ void e_categories_dialog_set_categories (ECategoriesDialog *dialog, const gchar *categories) { g_return_if_fail (E_IS_CATEGORIES_DIALOG (dialog)); e_categories_editor_set_categories ( E_CATEGORIES_EDITOR (dialog->priv->categories_editor), categories); } tion> <option value='gnome-3.36'>gnome-3.36</option> <option value='gstreamer'>gstreamer</option> <option value='gstreamer-1.16'>gstreamer-1.16</option> <option value='gstreamer0.10-removal'>gstreamer0.10-removal</option> <option value='main' selected='selected'>main</option> <option value='master'>master</option> <option value='mate-1.16'>mate-1.16</option> <option value='mate-1.18'>mate-1.18</option> <option value='mate-1.20'>mate-1.20</option> <option value='mate-1.22'>mate-1.22</option> </select> <input type='submit' value='switch'/></form></td></tr> <tr><td class='sub'>FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)</td><td class='sub right'></td></tr></table> <table class='tabs'><tr><td> <a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/about/'>about</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/'>summary</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/refs/?id=644e6756289396616b16551299ad9829f6bf8c94'>refs</a><a class='active' href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/devel/p5-Test-HTML-Tidy'>log</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/tree/devel/p5-Test-HTML-Tidy?id=644e6756289396616b16551299ad9829f6bf8c94'>tree</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/devel/p5-Test-HTML-Tidy?id=644e6756289396616b16551299ad9829f6bf8c94'>commit</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/diff/devel/p5-Test-HTML-Tidy?id=644e6756289396616b16551299ad9829f6bf8c94'>diff</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/stats/devel/p5-Test-HTML-Tidy'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/devel/p5-Test-HTML-Tidy'> <input type='hidden' name='id' value='644e6756289396616b16551299ad9829f6bf8c94'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/?id=644e6756289396616b16551299ad9829f6bf8c94'>root</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/devel?id=644e6756289396616b16551299ad9829f6bf8c94'>devel</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/devel/p5-Test-HTML-Tidy?id=644e6756289396616b16551299ad9829f6bf8c94'>p5-Test-HTML-Tidy</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/devel/p5-Test-HTML-Tidy?id=644e6756289396616b16551299ad9829f6bf8c94&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Age</th><th class='left'>Files</th><th class='left'>Lines</th></tr> <tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/devel/p5-Test-HTML-Tidy?id=042ea2947aef8c163db8d1f3fe5110ed8add79e4'>- Remove SITE_PERL from *_DEPENDS</a></td><td>Andrej Zverev</td><td><span title='2012-06-30 02:30:42 +0800'>2012-06-30</span>