Mon, 09 Jun 2008 19:31:43 +0000
Do not disable default smileys with dupliate shortcuts if custom smileys
are not supported by the prpl. Also, show the text of the disabled smiley
in the tooltip.
And use _prepend and _reverse, instead of _append for GLists, since some
people apparently have hundreds of custom smileys.
Closes #6057.
committer: Sadrul Habib Chowdhury <sadrul@pidgin.im>
| 10708 | 1 | /* gtkcellviewmenuitem.c |
| 2 | * Copyright (C) 2003 Kristian Rietveld <kris@gtk.org> | |
| 3 | * | |
| 4 | * This library is free software; you can redistribute it and/or | |
| 5 | * modify it under the terms of the GNU Library General Public | |
| 6 | * License as published by the Free Software Foundation; either | |
| 7 | * version 2 of the License, or (at your option) any later version. | |
| 8 | * | |
| 9 | * This library is distributed in the hope that it will be useful, | |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | * Library General Public License for more details. | |
| 13 | * | |
| 14 | * You should have received a copy of the GNU Library General Public | |
| 15 | * License along with this library; if not, write to the | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15562
diff
changeset
|
16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15562
diff
changeset
|
17 | * Boston, MA 02111-1301, USA. |
| 10708 | 18 | */ |
| 19 | ||
| 20 | /* | |
| 21 | #include <config.h> | |
| 22 | */ | |
| 23 | #include <gtk/gtkversion.h> | |
| 24 | #if !GTK_CHECK_VERSION(2,6,0) | |
| 25 | #include "gtkcellviewmenuitem.h" | |
| 26 | #include "gtkcellview.h" | |
| 27 | ||
| 28 | struct _GtkCellViewMenuItemPrivate | |
| 29 | { | |
| 30 | GtkWidget *cell_view; | |
| 31 | }; | |
| 32 | ||
| 33 | static void gtk_cell_view_menu_item_init (GtkCellViewMenuItem *item); | |
| 34 | static void gtk_cell_view_menu_item_class_init (GtkCellViewMenuItemClass *klass); | |
| 35 | static void gtk_cell_view_menu_item_finalize (GObject *object); | |
| 36 | ||
| 37 | ||
| 38 | GType | |
| 39 | gtk_cell_view_menu_item_get_type (void) | |
| 40 | { | |
| 41 | static GType cell_view_menu_item_type = 0; | |
| 42 | ||
| 43 | if (!cell_view_menu_item_type) | |
| 44 | { | |
| 45 | static const GTypeInfo cell_view_menu_item_info = | |
| 46 | { | |
| 47 | sizeof (GtkCellViewMenuItemClass), | |
| 48 | NULL, | |
| 49 | NULL, | |
| 50 | (GClassInitFunc) gtk_cell_view_menu_item_class_init, | |
| 51 | NULL, | |
| 52 | NULL, | |
| 53 | sizeof (GtkCellViewMenuItem), | |
| 54 | 0, | |
| 55 | (GInstanceInitFunc) gtk_cell_view_menu_item_init | |
| 56 | }; | |
| 57 | ||
| 58 | cell_view_menu_item_type = | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
59 | g_type_register_static (GTK_TYPE_MENU_ITEM, "PidginCellViewMenuItem", |
| 10708 | 60 | &cell_view_menu_item_info, 0); |
| 61 | } | |
| 62 | ||
| 63 | return cell_view_menu_item_type; | |
| 64 | } | |
| 65 | ||
| 66 | static void | |
| 67 | gtk_cell_view_menu_item_class_init (GtkCellViewMenuItemClass *klass) | |
| 68 | { | |
| 69 | GObjectClass *object_class; | |
| 70 | ||
| 71 | object_class = (GObjectClass *)klass; | |
| 72 | object_class->finalize = gtk_cell_view_menu_item_finalize; | |
| 73 | } | |
| 74 | ||
| 75 | static void | |
| 76 | gtk_cell_view_menu_item_init (GtkCellViewMenuItem *item) | |
| 77 | { | |
| 78 | item->priv = g_new0(GtkCellViewMenuItemPrivate,1); | |
| 79 | } | |
| 80 | ||
| 81 | GtkWidget * | |
| 82 | gtk_cell_view_menu_item_new (void) | |
| 83 | { | |
| 84 | GtkCellViewMenuItem *item; | |
| 85 | ||
| 86 | item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL); | |
| 87 | ||
| 88 | item->priv->cell_view = gtk_cell_view_new (); | |
| 89 | gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view); | |
| 90 | gtk_widget_show (item->priv->cell_view); | |
| 91 | ||
| 92 | return GTK_WIDGET (item); | |
| 93 | } | |
| 94 | ||
| 95 | GtkWidget * | |
| 96 | gtk_cell_view_menu_item_new_with_pixbuf (GdkPixbuf *pixbuf) | |
| 97 | { | |
| 98 | GtkCellViewMenuItem *item; | |
| 99 | ||
| 100 | item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL); | |
| 101 | ||
| 102 | item->priv->cell_view = gtk_cell_view_new_with_pixbuf (pixbuf); | |
| 103 | gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view); | |
| 104 | gtk_widget_show (item->priv->cell_view); | |
| 105 | ||
| 106 | return GTK_WIDGET (item); | |
| 107 | } | |
| 108 | ||
| 109 | GtkWidget * | |
| 110 | gtk_cell_view_menu_item_new_with_text (const gchar *text) | |
| 111 | { | |
| 112 | GtkCellViewMenuItem *item; | |
| 113 | ||
| 114 | item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL); | |
| 115 | ||
| 116 | item->priv->cell_view = gtk_cell_view_new_with_text (text); | |
| 117 | gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view); | |
| 118 | gtk_widget_show (item->priv->cell_view); | |
| 119 | ||
| 120 | return GTK_WIDGET (item); | |
| 121 | } | |
| 122 | ||
| 123 | GtkWidget * | |
| 124 | gtk_cell_view_menu_item_new_with_markup (const gchar *markup) | |
| 125 | { | |
| 126 | GtkCellViewMenuItem *item; | |
| 127 | ||
| 128 | item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL); | |
| 129 | ||
| 130 | item->priv->cell_view = gtk_cell_view_new_with_markup (markup); | |
| 131 | gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view); | |
| 132 | gtk_widget_show (item->priv->cell_view); | |
| 133 | ||
| 134 | return GTK_WIDGET (item); | |
| 135 | } | |
| 136 | ||
| 137 | GtkWidget * | |
| 138 | gtk_cell_view_menu_item_new_from_model (GtkTreeModel *model, | |
| 139 | GtkTreePath *path) | |
| 140 | { | |
| 141 | GtkCellViewMenuItem *item; | |
| 142 | ||
| 143 | item = g_object_new (GTK_TYPE_CELL_VIEW_MENU_ITEM, NULL); | |
| 144 | ||
| 145 | item->priv->cell_view = gtk_cell_view_new (); | |
| 146 | gtk_container_add (GTK_CONTAINER (item), item->priv->cell_view); | |
| 147 | ||
| 148 | gtk_cell_view_set_model (GTK_CELL_VIEW (item->priv->cell_view), model); | |
| 149 | gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (item->priv->cell_view), path); | |
| 150 | ||
| 151 | gtk_widget_show (item->priv->cell_view); | |
| 152 | ||
| 153 | return GTK_WIDGET (item); | |
| 154 | } | |
| 155 | ||
| 156 | static void | |
| 157 | gtk_cell_view_menu_item_finalize (GObject *object) | |
| 158 | { | |
| 159 | GtkCellViewMenuItem *item = GTK_CELL_VIEW_MENU_ITEM (object); | |
| 160 | ||
| 161 | g_free (item->priv); | |
| 162 | } | |
| 163 | #endif /* Gtk 2.6 */ |