[glom/gtktoolpallete] Partially use Gtk::Toolpalette instead of GtkToolpalette.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom/gtktoolpallete] Partially use Gtk::Toolpalette instead of GtkToolpalette.
- Date: Mon, 21 Dec 2009 11:31:15 +0000 (UTC)
commit 53ea041e121f0b94240cfb6cb19169b4a5512c1f
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Dec 21 12:31:04 2009 +0100
Partially use Gtk::Toolpalette instead of GtkToolpalette.
.../print_layouts/print_layout_toolbar_button.cc | 15 +++++++----
.../print_layouts/window_print_layout_edit.cc | 3 +-
glom/utility_widgets/flowtable_dnd.cc | 25 ++++++++++---------
glom/utility_widgets/sidebar.cc | 12 ++++-----
glom/utility_widgets/sidebar.h | 3 +-
5 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/glom/mode_design/print_layouts/print_layout_toolbar_button.cc b/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
index d075e79..fac9a48 100644
--- a/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
+++ b/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
@@ -19,7 +19,7 @@
*/
#include "print_layout_toolbar_button.h"
-#include <gtk/gtktoolpalette.h>
+#include <gtkmm/toolpalette.h>
#include <iostream>
namespace
@@ -69,18 +69,21 @@ PrintLayoutToolbarButton::enumItems PrintLayoutToolbarButton::get_item_type_from
PrintLayoutToolbarButton::enumItems result = ITEM_INVALID;
//Put this code in the toolbar class:
- Gtk::Widget* palette = drag_get_source_widget(drag_context);
- while(palette && !GTK_IS_TOOL_PALETTE (palette->gobj()))
- palette = palette->get_parent();
+ Gtk::Widget* palette_candidate = drag_get_source_widget(drag_context);
+ Gtk::ToolPalette* palette = dynamic_cast<Gtk::ToolPalette*>(palette_candidate);
+ while(palette_candidate && !palette) {
+ palette_candidate = palette_candidate->get_parent();
+ palette = dynamic_cast<Gtk::ToolPalette*>(palette_candidate);
+ }
if(!palette)
return result;
- GtkWidget* tool_item = gtk_tool_palette_get_drag_item(GTK_TOOL_PALETTE (palette->gobj()), selection_data.gobj());
+ Gtk::Widget* tool_item = palette->get_drag_item(selection_data);
if(!tool_item)
return result;
- result = static_cast<PrintLayoutToolbarButton::enumItems>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tool_item), "glom-type")));
+ result = static_cast<PrintLayoutToolbarButton::enumItems>(GPOINTER_TO_INT(tool_item->get_data("glom-type")));
return result;
}
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 7fa8b2a..250b3c6 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -78,8 +78,7 @@ Window_PrintLayout_Edit::Window_PrintLayout_Edit(BaseObjectType* cobject, const
m_canvas.show();
//Make the canvas a drag-and-drop destination:
- const GtkTargetEntry* target_entry = gtk_tool_palette_get_drag_target_item();
- Gtk::TargetEntry toolbar_target(*target_entry);
+ const Gtk::TargetEntry toolbar_target = Gtk::ToolPalette::get_drag_target_item();
m_drag_targets.push_back(toolbar_target);
//Note that we don't use Gtk::DEST_DEFAULT_DEFAULTS because that would prevent our signal handlers from being used:
diff --git a/glom/utility_widgets/flowtable_dnd.cc b/glom/utility_widgets/flowtable_dnd.cc
index ec7f701..218b7f1 100644
--- a/glom/utility_widgets/flowtable_dnd.cc
+++ b/glom/utility_widgets/flowtable_dnd.cc
@@ -20,7 +20,7 @@
#include "flowtable_dnd.h"
#include "../mode_data/flowtablewithfields.h"
-#include <gtk/gtktoolpalette.h>
+#include <gtkmm/toolpalette.h>
#include "placeholder-glom.h"
#include "layouttoolbarbutton.h"
#include "entryglom.h"
@@ -39,11 +39,10 @@ FlowTableDnd::FlowTableDnd() :
{
std::list<Gtk::TargetEntry> drag_targets;
- const GtkTargetEntry* target_entry = gtk_tool_palette_get_drag_target_item();
- Gtk::TargetEntry toolbar_target(*target_entry);
+ const Gtk::TargetEntry toolbar_target = Gtk::ToolPalette::get_drag_target_item();
drag_targets.push_back(toolbar_target);
- Gtk::TargetEntry move_target(MOVE_TARGET);
+ const Gtk::TargetEntry move_target(MOVE_TARGET);
drag_targets.push_back(move_target);
drag_dest_set(drag_targets);
@@ -88,10 +87,9 @@ void FlowTableDnd::start_dnd(Gtk::Widget& child)
if(!(child.get_flags() & Gtk::NO_WINDOW))
{
std::list<Gtk::TargetEntry> drag_targets;
- const GtkTargetEntry* target_entry = gtk_tool_palette_get_drag_target_item();
- Gtk::TargetEntry toolbar_target(*target_entry);
- Gtk::TargetEntry move_target(MOVE_TARGET);
+ const Gtk::TargetEntry toolbar_target = Gtk::ToolPalette::get_drag_target_item();
drag_targets.push_back(toolbar_target);
+ const Gtk::TargetEntry move_target(MOVE_TARGET);
drag_targets.push_back(move_target);
Glib::RefPtr<Gtk::TargetList> targets = child.drag_dest_get_target_list();
@@ -181,16 +179,19 @@ void FlowTableDnd::on_dnd_remove_placeholder()
void FlowTableDnd::on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& drag_context, int /* drag_x */, int /* drag_y */, const Gtk::SelectionData& selection_data, guint, guint /* time */)
{
- Gtk::Widget* palette = drag_get_source_widget(drag_context);
- while(palette && !GTK_IS_TOOL_PALETTE(palette->gobj()))
- palette = palette->get_parent();
+ Gtk::Widget* palette_candidate = drag_get_source_widget(drag_context);
+ Gtk::ToolPalette* palette = dynamic_cast<Gtk::ToolPalette*>(palette_candidate);
+ while(palette_candidate && !palette) {
+ palette_candidate = palette_candidate->get_parent();
+ palette = dynamic_cast<Gtk::ToolPalette*>(palette_candidate);
+ }
on_dnd_remove_placeholder();
Gtk::Widget* above = dnd_datawidget_from_item(0);
if(palette)
{
- GtkWidget* tool_item = gtk_tool_palette_get_drag_item(GTK_TOOL_PALETTE(palette->gobj()), selection_data.gobj());
- const int type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tool_item), "glom-type"));
+ Gtk::Widget* tool_item = palette->get_drag_item(selection_data);
+ const int type = GPOINTER_TO_INT(tool_item->get_data("glom-type"));
on_dnd_add_layout_item_by_type(type, above);
}
else
diff --git a/glom/utility_widgets/sidebar.cc b/glom/utility_widgets/sidebar.cc
index a83d69c..f63bbe7 100644
--- a/glom/utility_widgets/sidebar.cc
+++ b/glom/utility_widgets/sidebar.cc
@@ -30,11 +30,9 @@ SideBar::SideBar()
set_handle_position(Gtk::POS_TOP);
set_snap_edge(Gtk::POS_TOP);
- palette = GTK_TOOL_PALETTE(gtk_tool_palette_new());
- gtk_tool_palette_set_style (palette, GTK_TOOLBAR_BOTH_HORIZ);
- Gtk::Container* container = Glib::wrap(GTK_CONTAINER(palette));
+ m_palette.set_style(Gtk::TOOLBAR_BOTH_HORIZ);
- add(*container);
+ add(m_palette);
show_all_children();;
}
@@ -45,18 +43,18 @@ SideBar::~SideBar()
void SideBar::add_group(GtkToolItemGroup* group)
{
- gtk_container_add(GTK_CONTAINER(palette), GTK_WIDGET(group));
+ m_palette.add(*Glib::wrap(GTK_WIDGET(group)));
}
void SideBar::remove_group(GtkToolItemGroup* group)
{
- gtk_container_remove(GTK_CONTAINER(palette), GTK_WIDGET(group));
+ m_palette.remove(*Glib::wrap(GTK_WIDGET(group)));
}
void SideBar::set_drag_source()
{
// It's important to call this AFTER all groups have been added
- gtk_tool_palette_set_drag_source(palette, GTK_TOOL_PALETTE_DRAG_ITEMS);
+ m_palette.set_drag_source(Gtk::TOOL_PALETTE_DRAG_ITEMS);
}
void SideBar::on_child_detached(Gtk::Widget* child)
diff --git a/glom/utility_widgets/sidebar.h b/glom/utility_widgets/sidebar.h
index 1be2101..dbd2249 100644
--- a/glom/utility_widgets/sidebar.h
+++ b/glom/utility_widgets/sidebar.h
@@ -26,7 +26,6 @@
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include "gtkmm/toolpalette.h"
-#include "gtk/gtktoolpalette.h"
namespace Glom
{
@@ -47,7 +46,7 @@ private:
virtual void on_child_attached(Gtk::Widget* child);
private:
- GtkToolPalette* palette;
+ Gtk::ToolPalette m_palette;
int m_width;
int m_height;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]