2
/* Ekiga -- A VoIP and Video-Conferencing application
3
* Copyright (C) 2000-2007 Damien Sandras
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
* Ekiga is licensed under the GPL license and as a special exception,
21
* you have permission to link or otherwise combine this program with the
22
* programs OPAL, OpenH323 and PWLIB, and distribute the combination,
23
* without applying the requirements of the GNU GPL to the OPAL, OpenH323
24
* and PWLIB programs, as long as you do follow the requirements of the
25
* GNU GPL for all the rest of the software thus combined.
30
* toolbar-builder-gtk.cpp - description
31
* ------------------------------------------
32
* begin : written in 2007 by Julien Puydt
33
* copyright : (c) 2007 by Julien Puydt
34
* description : implementation of a gtk+ toolbar builder
40
#include "toolbar-builder-gtk.h"
44
Action (sigc::slot<void> _callback): callback (_callback)
47
sigc::slot<void> callback;
51
delete_action_with_item (gpointer data)
53
delete (Action *)data;
57
on_item_clicked (GtkToolButton *button,
60
Action *action = NULL;
62
action = (Action *)g_object_get_data (G_OBJECT (button),
63
"toolbar-builder-gtk-action");
72
ToolbarBuilderGtk::add_action (const std::string icon,
73
const std::string label,
74
sigc::slot<void> callback)
76
Action *action = new Action (callback);
77
GtkToolItem *item = NULL;
79
item = gtk_tool_button_new_from_stock (icon.c_str ());
80
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), label.c_str ());
81
g_object_set_data_full (G_OBJECT (item),
82
"toolbar-builder-gtk-action",
83
(gpointer)action, delete_action_with_item);
84
g_signal_connect (item, "clicked",
85
G_CALLBACK (on_item_clicked), NULL);
86
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
90
ToolbarBuilderGtk::add_separator ()
92
GtkToolItem *item = NULL;
94
item = gtk_separator_tool_item_new ();
95
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);