diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-12-10 21:09:59 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-12-13 03:33:43 +0800 |
commit | d09d8de870b6697c8a8b262e7e077b871a69b315 (patch) | |
tree | 3b718882e7a0bb0a996daf2967a033d91714c9b5 /widgets/table/gal-a11y-e-table-column-header.c | |
parent | b61331ed03ac1c7a9b8614e25510040b9c60ae02 (diff) | |
download | gsoc2013-evolution-d09d8de870b6697c8a8b262e7e077b871a69b315.tar gsoc2013-evolution-d09d8de870b6697c8a8b262e7e077b871a69b315.tar.gz gsoc2013-evolution-d09d8de870b6697c8a8b262e7e077b871a69b315.tar.bz2 gsoc2013-evolution-d09d8de870b6697c8a8b262e7e077b871a69b315.tar.lz gsoc2013-evolution-d09d8de870b6697c8a8b262e7e077b871a69b315.tar.xz gsoc2013-evolution-d09d8de870b6697c8a8b262e7e077b871a69b315.tar.zst gsoc2013-evolution-d09d8de870b6697c8a8b262e7e077b871a69b315.zip |
Consolidate base utility libraries into libeutil.
Evolution consists of entirely too many small utility libraries, which
increases linking and loading time, places a burden on higher layers of
the application (e.g. modules) which has to remember to link to all the
small in-tree utility libraries, and makes it difficult to generate API
documentation for these utility libraries in one Gtk-Doc module.
Merge the following utility libraries under the umbrella of libeutil,
and enforce a single-include policy on libeutil so we can reorganize
the files as desired without disrupting its pseudo-public API.
libemail-utils/libemail-utils.la
libevolution-utils/libevolution-utils.la
filter/libfilter.la
widgets/e-timezone-dialog/libetimezonedialog.la
widgets/menus/libmenus.la
widgets/misc/libemiscwidgets.la
widgets/table/libetable.la
widgets/text/libetext.la
This also merges libedataserverui from the Evolution-Data-Server module,
since Evolution is its only consumer nowadays, and I'd like to make some
improvements to those APIs without concern for backward-compatibility.
And finally, start a Gtk-Doc module for libeutil. It's going to be a
project just getting all the symbols _listed_ much less _documented_.
But the skeletal structure is in place and I'm off to a good start.
Diffstat (limited to 'widgets/table/gal-a11y-e-table-column-header.c')
-rw-r--r-- | widgets/table/gal-a11y-e-table-column-header.c | 241 |
1 files changed, 0 insertions, 241 deletions
diff --git a/widgets/table/gal-a11y-e-table-column-header.c b/widgets/table/gal-a11y-e-table-column-header.c deleted file mode 100644 index 05a99e381b..0000000000 --- a/widgets/table/gal-a11y-e-table-column-header.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Li Yuan <li.yuan@sun.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib/gi18n.h> -#include <atk/atkobject.h> -#include <atk/atkregistry.h> -#include "table/e-table-header-item.h" -#include "a11y/gal-a11y-util.h" -#include "gal-a11y-e-table-column-header.h" - -static GObjectClass *parent_class; -static gint priv_offset; - -#define GET_PRIVATE(object) \ - ((GalA11yETableColumnHeaderPrivate *) \ - (((gchar *) object) + priv_offset)) -#define PARENT_TYPE (atk_gobject_accessible_get_type ()) - -struct _GalA11yETableColumnHeaderPrivate { - ETableItem *item; - AtkObject *parent; - AtkStateSet *state_set; -}; - -static void -etch_init (GalA11yETableColumnHeader *a11y) -{ - GET_PRIVATE (a11y)->item = NULL; - GET_PRIVATE (a11y)->parent = NULL; - GET_PRIVATE (a11y)->state_set = NULL; -} - -static AtkStateSet * -gal_a11y_e_table_column_header_ref_state_set (AtkObject *accessible) -{ - GalA11yETableColumnHeaderPrivate *priv = GET_PRIVATE (accessible); - - g_return_val_if_fail (priv->state_set, NULL); - - g_object_ref (priv->state_set); - - return priv->state_set; -} - -static void -gal_a11y_e_table_column_header_real_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (parent_class)->initialize (obj, data); -} - -static void -gal_a11y_e_table_column_header_dispose (GObject *object) -{ - GalA11yETableColumnHeader *a11y = GAL_A11Y_E_TABLE_COLUMN_HEADER (object); - GalA11yETableColumnHeaderPrivate *priv = GET_PRIVATE (a11y); - - if (priv->state_set) { - g_object_unref (priv->state_set); - priv->state_set = NULL; - } - - if (parent_class->dispose) - parent_class->dispose (object); - -} - -static void -etch_class_init (GalA11yETableColumnHeaderClass *class) -{ - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class); - GObjectClass *object_class = G_OBJECT_CLASS (class); - - parent_class = g_type_class_ref (PARENT_TYPE); - - object_class->dispose = gal_a11y_e_table_column_header_dispose; - - atk_object_class->ref_state_set = gal_a11y_e_table_column_header_ref_state_set; - atk_object_class->initialize = gal_a11y_e_table_column_header_real_initialize; -} - -inline static GObject * -etch_a11y_get_gobject (AtkGObjectAccessible *accessible) -{ - return atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible)); -} - -static gboolean -gal_a11y_e_table_column_header_do_action (AtkAction *action, - gint i) -{ - gboolean return_value = TRUE; - GtkWidget *widget; - GalA11yETableColumnHeader *a11y; - ETableHeaderItem *ethi; - ETableItem *item; - ETableCol *col; - - switch (i) { - case 0: - a11y = GAL_A11Y_E_TABLE_COLUMN_HEADER (action); - col = E_TABLE_COL (etch_a11y_get_gobject ( - ATK_GOBJECT_ACCESSIBLE (a11y))); - item = GET_PRIVATE (a11y)->item; - widget = gtk_widget_get_parent (GTK_WIDGET (item->parent.canvas)); - if (E_IS_TREE (widget)) { - ethi = E_TABLE_HEADER_ITEM ( - e_tree_get_header_item (E_TREE (widget))); - } - else if (E_IS_TABLE (widget)) - ethi = E_TABLE_HEADER_ITEM ( - E_TABLE (widget)->header_item); - else - break; - ethi_change_sort_state (ethi, col); - default: - return_value = FALSE; - break; - } - return return_value; -} - -static gint -gal_a11y_e_table_column_header_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const gchar * -gal_a11y_e_table_column_header_action_get_name (AtkAction *action, - gint i) -{ - const gchar *return_value; - - switch (i) { - case 0: - return_value = _("sort"); - break; - default: - return_value = NULL; - break; - } - return return_value; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - g_return_if_fail (iface != NULL); - - iface->do_action = gal_a11y_e_table_column_header_do_action; - iface->get_n_actions = gal_a11y_e_table_column_header_get_n_actions; - iface->get_name = gal_a11y_e_table_column_header_action_get_name; -} - -GType -gal_a11y_e_table_column_header_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof (GalA11yETableColumnHeaderClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) etch_class_init, - (GClassFinalizeFunc) NULL, - NULL, - sizeof (GalA11yETableColumnHeader), - 0, - (GInstanceInitFunc) etch_init, - NULL - }; - static const GInterfaceInfo atk_action_info = { - (GInterfaceInitFunc) atk_action_interface_init, - (GInterfaceFinalizeFunc) NULL, - NULL - }; - - type = gal_a11y_type_register_static_with_private ( - PARENT_TYPE, "GalA11yETableColumnHeader", &info, 0, - sizeof (GalA11yETableColumnHeaderPrivate), &priv_offset); - - g_type_add_interface_static ( - type, ATK_TYPE_ACTION, &atk_action_info); - } - - return type; -} - -AtkObject * -gal_a11y_e_table_column_header_new (ETableCol *ecol, - ETableItem *item) -{ - GalA11yETableColumnHeader *a11y; - AtkObject *accessible; - - g_return_val_if_fail (E_IS_TABLE_COL (ecol), NULL); - - a11y = g_object_new (gal_a11y_e_table_column_header_get_type (), NULL); - accessible = ATK_OBJECT (a11y); - atk_object_initialize (accessible, ecol); - - GET_PRIVATE (a11y)->item = item; - GET_PRIVATE (a11y)->state_set = atk_state_set_new (); - - atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_VISIBLE); - atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_SHOWING); - atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_SENSITIVE); - atk_state_set_add_state (GET_PRIVATE (a11y)->state_set, ATK_STATE_ENABLED); - - if (ecol->text) - atk_object_set_name (accessible, ecol->text); - atk_object_set_role (accessible, ATK_ROLE_TABLE_COLUMN_HEADER); - - return ATK_OBJECT (a11y); -} |