[emerillon/gtk3: 1/5] bgo649403: Support gtk3



commit 5851599f3eb2cde3cc4fee9eeb4d2e1a25666099
Author: Tom Callaway <tcallawa redhat com>
Date:   Sat Jun 25 13:33:06 2011 +0200

    bgo649403: Support gtk3

 emerillon/preferences.c            |    2 +-
 emerillon/sidebar.c                |   18 ++++++--------
 emerillon/window.c                 |    2 +-
 plugins/placemarks/add-dialog.c    |    2 +-
 plugins/placemarks/manage-dialog.c |    2 +-
 plugins/placemarks/placemarks.c    |   19 +++++++--------
 plugins/search/search.c            |   42 +++++++++++++++++++----------------
 7 files changed, 44 insertions(+), 43 deletions(-)
---
diff --git a/emerillon/preferences.c b/emerillon/preferences.c
index 774d456..0f11707 100644
--- a/emerillon/preferences.c
+++ b/emerillon/preferences.c
@@ -136,7 +136,7 @@ build_ui (EmerillonPreferences *self)
 
   gtk_window_set_title (GTK_WINDOW (self), _("Emerillon Preferences"));
 
-  gtk_dialog_set_has_separator (dialog, FALSE);
+  /* gtk_dialog_set_has_separator (dialog, FALSE); */
   gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
   gtk_widget_set_size_request (GTK_WIDGET (dialog), 400, 400);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
diff --git a/emerillon/sidebar.c b/emerillon/sidebar.c
index 4d3719d..980be91 100644
--- a/emerillon/sidebar.c
+++ b/emerillon/sidebar.c
@@ -75,7 +75,7 @@ G_DEFINE_TYPE (EmerillonSidebar, emerillon_sidebar, GTK_TYPE_VBOX)
     (G_TYPE_INSTANCE_GET_PRIVATE ((object), EMERILLON_TYPE_SIDEBAR, EmerillonSidebarPrivate))
 
 static void
-emerillon_sidebar_destroy (GtkObject *object)
+emerillon_sidebar_dispose (GObject *object)
 {
   EmerillonSidebar *sidebar = EMERILLON_SIDEBAR (object);
 
@@ -91,7 +91,7 @@ emerillon_sidebar_destroy (GtkObject *object)
       sidebar->priv->page_model = NULL;
     }
 
-  (* GTK_OBJECT_CLASS (emerillon_sidebar_parent_class)->destroy) (object);
+  (* G_OBJECT_CLASS (emerillon_sidebar_parent_class)->dispose) (object);
 }
 
 static void
@@ -196,15 +196,13 @@ emerillon_sidebar_class_init (EmerillonSidebarClass *emerillon_sidebar_class)
 {
   GObjectClass *g_object_class;
   GtkWidgetClass *widget_class;
-  GtkObjectClass *gtk_object_klass;
 
   g_object_class = G_OBJECT_CLASS (emerillon_sidebar_class);
   widget_class = GTK_WIDGET_CLASS (emerillon_sidebar_class);
-  gtk_object_klass = GTK_OBJECT_CLASS (emerillon_sidebar_class);
 
   g_type_class_add_private (g_object_class, sizeof (EmerillonSidebarPrivate));
 
-  gtk_object_klass->destroy = emerillon_sidebar_destroy;
+  g_object_class->dispose = emerillon_sidebar_dispose;
   g_object_class->get_property = emerillon_sidebar_get_property;
   g_object_class->set_property = emerillon_sidebar_set_property;
 
@@ -270,7 +268,7 @@ emerillon_sidebar_select_button_press_cb (GtkWidget *widget,
       width = allocation.width;
 
       gtk_widget_set_size_request (sidebar->priv->menu, -1, -1);
-      gtk_widget_size_request (sidebar->priv->menu, &requisition);
+      gtk_widget_get_preferred_size(sidebar->priv->menu, NULL, &requisition);
       gtk_widget_set_size_request (sidebar->priv->menu,
           MAX (width, requisition.width), -1);
 
@@ -295,10 +293,10 @@ emerillon_sidebar_select_button_key_press_cb (GtkWidget *widget,
 {
   EmerillonSidebar *sidebar = EMERILLON_SIDEBAR (user_data);
 
-  if (event->keyval == GDK_space ||
-      event->keyval == GDK_KP_Space ||
-      event->keyval == GDK_Return ||
-      event->keyval == GDK_KP_Enter)
+  if (event->keyval == GDK_KEY_space ||
+      event->keyval == GDK_KEY_KP_Space ||
+      event->keyval == GDK_KEY_Return ||
+      event->keyval == GDK_KEY_KP_Enter)
     {
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
 
diff --git a/emerillon/window.c b/emerillon/window.c
index 260163a..f758e6e 100644
--- a/emerillon/window.c
+++ b/emerillon/window.c
@@ -894,7 +894,7 @@ build_ui (EmerillonWindow *self)
   g_signal_connect (self->priv->view, "notify::state",
       G_CALLBACK (state_changed_cb), self);
   g_object_set (self->priv->view, "zoom-level", 1,
-      "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC,
+      "kinetic-mode", TRUE,
 #if CHAMPLAIN_CHECK_VERSION (0, 4, 3)
       "show-scale", TRUE,
 #endif
diff --git a/plugins/placemarks/add-dialog.c b/plugins/placemarks/add-dialog.c
index 054383b..a0a1a8e 100644
--- a/plugins/placemarks/add-dialog.c
+++ b/plugins/placemarks/add-dialog.c
@@ -116,7 +116,7 @@ build_ui (AddDialog *self)
 
   gtk_window_set_title (GTK_WINDOW (self), _("New Placemark"));
 
-  gtk_dialog_set_has_separator (dialog, FALSE);
+  /* gtk_dialog_set_has_separator (dialog, FALSE); */
   gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
   gtk_dialog_add_button (dialog, GTK_STOCK_ADD, GTK_RESPONSE_OK);
   gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
diff --git a/plugins/placemarks/manage-dialog.c b/plugins/placemarks/manage-dialog.c
index 34c2b93..87cbc02 100644
--- a/plugins/placemarks/manage-dialog.c
+++ b/plugins/placemarks/manage-dialog.c
@@ -202,7 +202,7 @@ build_ui (ManageDialog *self)
 
   gtk_window_set_title (GTK_WINDOW (self), _("Organize Placemarks"));
 
-  gtk_dialog_set_has_separator (dialog, FALSE);
+  /* gtk_dialog_set_has_separator (dialog, FALSE); */
   gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
   gtk_dialog_set_default_response (dialog, GTK_RESPONSE_CLOSE);
   gtk_widget_set_size_request (GTK_WIDGET (dialog), 400, 300);
diff --git a/plugins/placemarks/placemarks.c b/plugins/placemarks/placemarks.c
index b8e8784..b42ff90 100644
--- a/plugins/placemarks/placemarks.c
+++ b/plugins/placemarks/placemarks.c
@@ -48,7 +48,7 @@ struct _PlacemarksPluginPrivate
   GtkWidget *menu;
 
   /** Layer with placemark markers */
-  ChamplainLayer *markers_layer;
+  ChamplainMarkerLayer *markers_layer;
   guint deleted_cb_id;
 };
 
@@ -108,15 +108,14 @@ add_marker(PlacemarksPlugin *plugin, const gchar *name, gdouble lat, gdouble lon
   ChamplainMarker *marker;
 
   ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb };
-  marker = CHAMPLAIN_MARKER ( champlain_marker_new_with_text (name, "Serif 14",
+  marker = CHAMPLAIN_LABEL ( champlain_label_new_with_text (name, "Serif 14",
                                                               NULL, NULL));
-  champlain_marker_set_use_markup (CHAMPLAIN_MARKER (marker), TRUE);
-  champlain_marker_set_alignment (CHAMPLAIN_MARKER (marker), PANGO_ALIGN_RIGHT);
-  champlain_marker_set_color (CHAMPLAIN_MARKER (marker), &orange);
+  champlain_label_set_use_markup (CHAMPLAIN_LABEL (marker), TRUE);
+  champlain_label_set_alignment (CHAMPLAIN_LABEL (marker), PANGO_ALIGN_RIGHT);
+  champlain_label_set_color (CHAMPLAIN_LABEL (marker), &orange);
 
-  champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker),
-                                      lat, lon);
-  champlain_layer_add_marker (priv->markers_layer, CHAMPLAIN_BASE_MARKER (marker));
+  champlain_location_set_location (CHAMPLAIN_LOCATION(marker), lat, lon);
+  champlain_marker_layer_add_marker (priv->markers_layer, CHAMPLAIN_MARKER (marker));
 
   return marker;
 }
@@ -561,8 +560,8 @@ activated (EthosPlugin *plugin)
   priv->window = EMERILLON_WINDOW (emerillon_window_dup_default ());
   priv->map_view = emerillon_window_get_map_view (priv->window);
 
-  priv->markers_layer = champlain_selection_layer_new ();
-  champlain_view_add_layer(priv->map_view, priv->markers_layer);
+  priv->markers_layer = champlain_marker_layer_new_full (CHAMPLAIN_SELECTION_NONE);
+  champlain_view_add_layer(priv->map_view, CHAMPLAIN_LAYER(priv->markers_layer));
 
   manager = emerillon_window_get_ui_manager (priv->window);
 
diff --git a/plugins/search/search.c b/plugins/search/search.c
index 92a32dc..f16b75b 100644
--- a/plugins/search/search.c
+++ b/plugins/search/search.c
@@ -52,7 +52,7 @@ struct _SearchPluginPrivate
   RestProxyCall *call;
 
   ChamplainView *map_view;
-  ChamplainLayer *layer;
+  ChamplainMarkerLayer *layer;
 };
 
 static void
@@ -86,6 +86,7 @@ result_cb (RestProxyCall *call,
   RestXmlNode *root, *n;
   gfloat min_lat, max_lat, min_lon, max_lon;
   SearchPluginPrivate *priv = SEARCH_PLUGIN (plugin)->priv;
+  ChamplainBoundingBox *bbox = champlain_bounding_box_new();
 
   answer = rest_proxy_call_get_payload (call);
   len = rest_proxy_call_get_payload_length (call);
@@ -128,7 +129,7 @@ result_cb (RestProxyCall *call,
     {
       RestXmlNode *name, *country, *lon, *lat;
       GtkTreeIter iter;
-      ChamplainMarker *marker;
+      ChamplainLabel *marker;
       gchar *symbol, *display_name, *escaped_name;
       gfloat flon, flat;
 
@@ -179,9 +180,9 @@ result_cb (RestProxyCall *call,
         min_lon = flon;
 
       /* Create the marker */
-      marker = CHAMPLAIN_MARKER (champlain_marker_new ());
-      champlain_marker_set_text (marker, symbol);
-      champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker),
+      marker = champlain_label_new();
+      champlain_label_set_text (marker, symbol);
+      champlain_location_set_location (CHAMPLAIN_LOCATION(marker),
           flat,
           flon);
       clutter_container_add_actor (CLUTTER_CONTAINER (priv->layer),
@@ -208,9 +209,13 @@ result_cb (RestProxyCall *call,
       i++;
     }
 
+  bbox->left = min_lon;
+  bbox->right = max_lon;
+  bbox->bottom = min_lat;
+  bbox->top = max_lat;
+
   champlain_view_ensure_visible (priv->map_view,
-      min_lat, min_lon,
-      max_lat, max_lon,
+      bbox,
       FALSE);
 
   rest_xml_node_unref (root);
@@ -236,7 +241,7 @@ search_address (SearchPlugin *plugin)
   children = clutter_container_get_children (CLUTTER_CONTAINER (priv->layer));
   for (l = children; l != NULL; l = l->next)
     {
-      champlain_layer_remove_marker (priv->layer, CHAMPLAIN_BASE_MARKER (l->data));
+      champlain_marker_layer_remove_marker (priv->layer, CHAMPLAIN_MARKER (l->data));
     }
   g_list_free (children);
 
@@ -291,15 +296,15 @@ search_icon_activate_cb (GtkEntry *entry,
 
 #if CHAMPLAIN_CHECK_VERSION(0, 4, 1)
 static void
-marker_selected_cb (ChamplainSelectionLayer *layer,
+marker_selected_cb (ChamplainMarkerLayer *layer,
                     SearchPlugin *plugin)
 {
   GtkTreeIter iter;
-  ChamplainBaseMarker *selected;
+  ChamplainMarker *selected;
   GtkTreeSelection *selection;
   SearchPluginPrivate *priv = SEARCH_PLUGIN (plugin)->priv;
 
-  selected = champlain_selection_layer_get_selected (layer);
+  selected = champlain_marker_layer_get_selected (layer);
 
   if (!selected)
     return;
@@ -311,7 +316,7 @@ marker_selected_cb (ChamplainSelectionLayer *layer,
 
   do
     {
-      ChamplainBaseMarker *marker;
+      ChamplainMarker *marker;
       gtk_tree_model_get (priv->model, &iter, COL_MARKER, &marker, -1);
 
       if (!marker)
@@ -335,7 +340,7 @@ row_selected_cb (GtkTreeSelection *selection,
                  SearchPlugin *plugin)
 {
   GtkTreeIter iter;
-  ChamplainBaseMarker *marker;
+  ChamplainMarker *marker;
   SearchPluginPrivate *priv = SEARCH_PLUGIN (plugin)->priv;
 
   if (!gtk_tree_selection_get_selected (selection, &priv->model, &iter))
@@ -346,8 +351,7 @@ row_selected_cb (GtkTreeSelection *selection,
   if (!marker)
     return;
 
-  champlain_selection_layer_select (CHAMPLAIN_SELECTION_LAYER (priv->layer),
-        marker);
+  champlain_marker_layer_add_marker (priv->layer, marker);
 
   g_object_unref (marker);
 }
@@ -389,7 +393,7 @@ select_function_cb (GtkTreeSelection *selection,
 {
   GtkTreeIter iter;
   GValue value = {0};
-  ChamplainBaseMarker *marker;
+  ChamplainMarker *marker;
   SearchPluginPrivate *priv = SEARCH_PLUGIN (plugin)->priv;
 
   if (path_currently_selected)
@@ -517,9 +521,9 @@ activated (EthosPlugin *plugin)
   gtk_widget_show (priv->search_page);
 
   /* Setup result layer */
-  priv->layer = champlain_selection_layer_new();
+  priv->layer = champlain_marker_layer_new();
   champlain_view_add_layer (priv->map_view,
-      priv->layer);
+      CHAMPLAIN_LAYER(priv->layer));
 
 #if CHAMPLAIN_CHECK_VERSION(0, 4, 1)
   g_signal_connect (priv->layer,
@@ -564,7 +568,7 @@ deactivated (EthosPlugin *plugin)
   view = emerillon_window_get_map_view (EMERILLON_WINDOW (window));
 
 #if CHAMPLAIN_CHECK_VERSION(0, 4, 1)
-  champlain_view_remove_layer (view, priv->layer);
+  champlain_view_remove_layer (view, CHAMPLAIN_LAYER(priv->layer));
 #endif
 
   gtk_container_remove (GTK_CONTAINER (toolbar), GTK_WIDGET (priv->search_item));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]