[libpeas] PeasPluginManager and View cleanup and style fixes
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] PeasPluginManager and View cleanup and style fixes
- Date: Mon, 17 Jan 2011 13:34:09 +0000 (UTC)
commit 5baaabf28790b45967e205b50b3c96ad1038da8f
Author: Garrett Regier <alias301 gmail com>
Date: Sun Jan 16 14:00:20 2011 -0800
PeasPluginManager and View cleanup and style fixes
libpeas-gtk/peas-gtk-plugin-manager-view.c | 36 +++++++++++----------------
libpeas-gtk/peas-gtk-plugin-manager.c | 34 +++++++------------------
2 files changed, 25 insertions(+), 45 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index 15ee36e..4f8e7d3 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -355,19 +355,23 @@ menu_position_under_tree_view (GtkMenu *menu,
else
{
GtkAllocation allocation;
+
gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation);
+
*x += allocation.x;
*y += allocation.y;
if (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL)
{
GtkRequisition requisition;
+
#if !GTK_CHECK_VERSION(2,90,7)
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
#else
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition,
NULL);
#endif
+
*x += allocation.width - requisition.width;
}
}
@@ -504,6 +508,10 @@ peas_gtk_plugin_manager_view_init (PeasGtkPluginManagerView *view)
(GtkTreeViewSearchEqualFunc) name_search_cb,
view,
NULL);
+
+ /* Properly set the model */
+ view->priv->show_builtin = TRUE;
+ peas_gtk_plugin_manager_view_set_show_builtin (view, FALSE);
}
static gboolean
@@ -566,7 +574,7 @@ peas_gtk_plugin_manager_view_set_property (GObject *object,
{
case PROP_SHOW_BUILTIN:
peas_gtk_plugin_manager_view_set_show_builtin (view,
- g_value_get_boolean (value));
+ g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -595,19 +603,6 @@ peas_gtk_plugin_manager_view_get_property (GObject *object,
}
static void
-peas_gtk_plugin_manager_view_constructed (GObject *object)
-{
- PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (object);
-
- /* Properly set the model */
- view->priv->show_builtin = TRUE;
- peas_gtk_plugin_manager_view_set_show_builtin (view, FALSE);
-
- if (G_OBJECT_CLASS (peas_gtk_plugin_manager_view_parent_class)->constructed != NULL)
- G_OBJECT_CLASS (peas_gtk_plugin_manager_view_parent_class)->constructed (object);
-}
-
-static void
peas_gtk_plugin_manager_view_dispose (GObject *object)
{
PeasGtkPluginManagerView *view = PEAS_GTK_PLUGIN_MANAGER_VIEW (object);
@@ -647,7 +642,6 @@ peas_gtk_plugin_manager_view_class_init (PeasGtkPluginManagerViewClass *klass)
object_class->set_property = peas_gtk_plugin_manager_view_set_property;
object_class->get_property = peas_gtk_plugin_manager_view_get_property;
- object_class->constructed = peas_gtk_plugin_manager_view_constructed;
object_class->dispose = peas_gtk_plugin_manager_view_dispose;
widget_class->button_press_event = peas_gtk_plugin_manager_view_button_press_event;
@@ -715,7 +709,7 @@ peas_gtk_plugin_manager_view_new (void)
*/
void
peas_gtk_plugin_manager_view_set_show_builtin (PeasGtkPluginManagerView *view,
- gboolean show_builtin)
+ gboolean show_builtin)
{
GtkTreeIter iter;
gboolean iter_set;
@@ -733,7 +727,7 @@ peas_gtk_plugin_manager_view_set_show_builtin (PeasGtkPluginManagerView *view,
view->priv->show_builtin = show_builtin;
- if (show_builtin == TRUE)
+ if (show_builtin)
{
gtk_tree_view_set_model (GTK_TREE_VIEW (view),
GTK_TREE_MODEL (view->priv->store));
@@ -782,7 +776,7 @@ peas_gtk_plugin_manager_view_get_show_builtin (PeasGtkPluginManagerView *view)
*/
void
peas_gtk_plugin_manager_view_set_selected_iter (PeasGtkPluginManagerView *view,
- GtkTreeIter *iter)
+ GtkTreeIter *iter)
{
GtkTreeSelection *selection;
@@ -807,7 +801,7 @@ peas_gtk_plugin_manager_view_set_selected_iter (PeasGtkPluginManagerView *view,
*/
gboolean
peas_gtk_plugin_manager_view_get_selected_iter (PeasGtkPluginManagerView *view,
- GtkTreeIter *iter)
+ GtkTreeIter *iter)
{
GtkTreeSelection *selection;
@@ -833,7 +827,7 @@ peas_gtk_plugin_manager_view_get_selected_iter (PeasGtkPluginManagerView *view,
*/
void
peas_gtk_plugin_manager_view_set_selected_plugin (PeasGtkPluginManagerView *view,
- PeasPluginInfo *info)
+ PeasPluginInfo *info)
{
GtkTreeIter iter;
GtkTreeSelection *selection;
@@ -842,7 +836,7 @@ peas_gtk_plugin_manager_view_set_selected_plugin (PeasGtkPluginManagerView *view
g_return_if_fail (info != NULL);
g_return_if_fail (peas_gtk_plugin_manager_store_get_iter_from_plugin (view->priv->store,
- &iter, info));
+ &iter, info));
if (!convert_child_iter_to_iter (view, &iter))
return;
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.c b/libpeas-gtk/peas-gtk-plugin-manager.c
index 1843d15..9e2880b 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager.c
@@ -310,21 +310,7 @@ plugin_loaded_toggled_cb (PeasEngine *engine,
}
static void
-selection_changed_cb (GtkTreeSelection *selection,
- PeasGtkPluginManager *pm)
-{
- PeasGtkPluginManagerView *view;
- PeasPluginInfo *info;
-
- view = PEAS_GTK_PLUGIN_MANAGER_VIEW (pm->priv->view);
- info = peas_gtk_plugin_manager_view_get_selected_plugin (view);
-
- update_button_sensitivity (pm, info);
-}
-
-static void
-cursor_changed_cb (GtkTreeView *tree_view,
- PeasGtkPluginManager *pm)
+selection_changed_cb (PeasGtkPluginManager *pm)
{
PeasGtkPluginManagerView *view;
PeasPluginInfo *info;
@@ -437,21 +423,21 @@ peas_gtk_plugin_manager_init (PeasGtkPluginManager *pm)
"unload-plugin",
G_CALLBACK (plugin_loaded_toggled_cb),
pm);
- g_signal_connect (selection,
- "changed",
- G_CALLBACK (selection_changed_cb),
- pm);
- g_signal_connect (pm->priv->view,
- "cursor-changed",
- G_CALLBACK (cursor_changed_cb),
- pm);
+ g_signal_connect_swapped (selection,
+ "changed",
+ G_CALLBACK (selection_changed_cb),
+ pm);
+ g_signal_connect_swapped (pm->priv->view,
+ "cursor-changed",
+ G_CALLBACK (selection_changed_cb),
+ pm);
g_signal_connect (pm->priv->view,
"populate-popup",
G_CALLBACK (populate_popup_cb),
pm);
/* Update the button sensitivity */
- selection_changed_cb (selection, pm);
+ selection_changed_cb (pm);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]