remove all gtk3 conditionals
[claws.git] / src / gtk / gtkcmclist.c
index 3009e39..d3bb336 100644 (file)
@@ -175,13 +175,6 @@ enum {
   ARG_REORDERABLE,
   ARG_USE_DRAG_ICONS,
   ARG_SORT_TYPE
-#if GTK_CHECK_VERSION(3, 0, 0)
-  ,
-  ARG_HADJUSTMENT,
-  ARG_VADJUSTMENT,
-  ARG_HADJUSTMENT_POLICY,
-  ARG_VADJUSTMENT_POLICY
-#endif
 };
 
 /* GtkCMCList Methods */
@@ -192,11 +185,7 @@ static GObject* gtk_cmclist_constructor (GType                  type,
                                       GObjectConstructParam *construct_params);
 
 /* GtkObject Methods */
-#if !GTK_CHECK_VERSION(3, 0, 0)
 static void gtk_cmclist_destroy  (GtkObject *object);
-#else
-static void gtk_cmclist_destroy  (GtkWidget *object);
-#endif
 static void gtk_cmclist_finalize (GObject   *object);
 static void gtk_cmclist_set_arg  (GObject *object,
                                guint      arg_id,
@@ -208,36 +197,21 @@ static void gtk_cmclist_get_arg  (GObject *object,
                                GParamSpec *spec);
 
 /* GtkWidget Methods */
-#if !GTK_CHECK_VERSION(3, 0, 0)
 static void gtk_cmclist_set_scroll_adjustments (GtkCMCList      *clist,
                                              GtkAdjustment *hadjustment,
                                              GtkAdjustment *vadjustment);
-#endif
 static void gtk_cmclist_realize         (GtkWidget        *widget);
 static void gtk_cmclist_unrealize       (GtkWidget        *widget);
 static void gtk_cmclist_map             (GtkWidget        *widget);
 static void gtk_cmclist_unmap           (GtkWidget        *widget);
-#if !GTK_CHECK_VERSION(3, 0, 0)
 static gint gtk_cmclist_expose          (GtkWidget        *widget,
                                          GdkEventExpose   *event);
-#else
-static gint gtk_cmclist_expose          (GtkWidget *widget,
-                                         cairo_t *event);
-#endif
 static gint gtk_cmclist_button_press    (GtkWidget        *widget,
                                       GdkEventButton   *event);
 static gint gtk_cmclist_button_release  (GtkWidget        *widget,
                                       GdkEventButton   *event);
 static gint gtk_cmclist_motion          (GtkWidget        *widget, 
                                       GdkEventMotion   *event);
-#if GTK_CHECK_VERSION(3, 0, 0)
-static void gtk_cmclist_get_preferred_height (GtkWidget *widget,
-                                 gint      *minimal_height,
-                                 gint      *natural_height);
-static void gtk_cmclist_get_preferred_width (GtkWidget *widget,
-                                 gint      *minimal_width,
-                                 gint      *natural_width);
-#endif
 static void gtk_cmclist_size_request    (GtkWidget        *widget,
                                       GtkRequisition   *requisition);
 static void gtk_cmclist_size_allocate   (GtkWidget        *widget,
@@ -480,7 +454,6 @@ static guint clist_signals[LAST_SIGNAL] = {0};
 
 static const GtkTargetEntry clist_target_table = { "gtk-clist-drag-reorder", 0, 0};
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
 static gpointer gtk_cmclist_parent_class = NULL;
 
 GType
@@ -512,41 +485,26 @@ gtk_cmclist_get_type (void)
 
   return clist_type;
 }
-#else
-G_DEFINE_TYPE_WITH_CODE (GtkCMCList, gtk_cmclist, GTK_TYPE_CONTAINER,
-                         G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE,
-                         NULL))
-#endif
 
 static void
 gtk_cmclist_class_init (GtkCMCListClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
-#if !GTK_CHECK_VERSION(3, 0, 0)
   GtkObjectClass *gtk_object_class;
-#endif
   GtkWidgetClass *widget_class;
   GtkContainerClass *container_class;
   GtkBindingSet *binding_set;
 
   object_class->constructor = gtk_cmclist_constructor;
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
   gtk_object_class = (GtkObjectClass *) klass;
-#endif
   widget_class = (GtkWidgetClass *) klass;
   container_class = (GtkContainerClass *) klass;
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
   gtk_cmclist_parent_class = g_type_class_peek (GTK_TYPE_CONTAINER);
-#endif
 
   object_class->finalize = gtk_cmclist_finalize;
-#if !GTK_CHECK_VERSION(3, 0, 0)
   gtk_object_class->destroy = gtk_cmclist_destroy;
-#else
-  widget_class->destroy = gtk_cmclist_destroy;
-#endif
   object_class->set_property = gtk_cmclist_set_arg;
   object_class->get_property = gtk_cmclist_get_arg;
   
@@ -558,17 +516,8 @@ gtk_cmclist_class_init (GtkCMCListClass *klass)
   widget_class->button_press_event = gtk_cmclist_button_press;
   widget_class->button_release_event = gtk_cmclist_button_release;
   widget_class->motion_notify_event = gtk_cmclist_motion;
-#if !GTK_CHECK_VERSION(3, 0, 0)
   widget_class->expose_event = gtk_cmclist_expose;
-#else
-  widget_class->draw = gtk_cmclist_expose;
-#endif
-#if !GTK_CHECK_VERSION(3, 0, 0)
   widget_class->size_request = gtk_cmclist_size_request;
-#else
-  widget_class->get_preferred_width = gtk_cmclist_get_preferred_width;
-  widget_class->get_preferred_height = gtk_cmclist_get_preferred_height;
-#endif
   widget_class->size_allocate = gtk_cmclist_size_allocate;
   widget_class->focus_in_event = gtk_cmclist_focus_in;
   widget_class->focus_out_event = gtk_cmclist_focus_out;
@@ -588,9 +537,7 @@ gtk_cmclist_class_init (GtkCMCListClass *klass)
   container_class->forall = gtk_cmclist_forall;
   container_class->set_focus_child = gtk_cmclist_set_focus_child;
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
   klass->set_scroll_adjustments = gtk_cmclist_set_scroll_adjustments;
-#endif
   klass->refresh = clist_refresh;
   klass->select_row = real_select_row;
   klass->unselect_row = real_unselect_row;
@@ -679,7 +626,6 @@ gtk_cmclist_class_init (GtkCMCListClass *klass)
                                "sort-type",
                                GTK_TYPE_SORT_TYPE, 0,
                                G_PARAM_READWRITE));
-#if !GTK_CHECK_VERSION(3, 0, 0)
   widget_class->set_scroll_adjustments_signal =
                g_signal_new ("set_scroll_adjustments",
                              G_TYPE_FROM_CLASS (object_class),
@@ -689,13 +635,6 @@ gtk_cmclist_class_init (GtkCMCListClass *klass)
                              claws_marshal_VOID__OBJECT_OBJECT,
                              G_TYPE_NONE, 2,
                              GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-#else
-  /* Scrollable interface properties */
-  g_object_class_override_property (object_class, ARG_HADJUSTMENT, "hadjustment");
-  g_object_class_override_property (object_class, ARG_VADJUSTMENT, "vadjustment");
-  g_object_class_override_property (object_class, ARG_HADJUSTMENT_POLICY, "hscroll-policy");
-  g_object_class_override_property (object_class, ARG_VADJUSTMENT_POLICY, "vscroll-policy");
-#endif
 
   clist_signals[SELECT_ROW] =
                g_signal_new ("select_row",
@@ -1047,17 +986,6 @@ gtk_cmclist_set_arg (GObject *object,
     case ARG_SORT_TYPE:
       gtk_cmclist_set_sort_type (clist, g_value_get_enum (value));
       break;
-#if GTK_CHECK_VERSION(3, 0, 0)
-    case ARG_HADJUSTMENT:
-      gtk_cmclist_set_hadjustment (clist, g_value_get_object (value));
-      break;
-    case ARG_VADJUSTMENT:
-      gtk_cmclist_set_vadjustment (clist, g_value_get_object (value));
-      break;
-    case ARG_HADJUSTMENT_POLICY:
-    case ARG_VADJUSTMENT_POLICY:
-      break;
-#endif
     }
 }
 
@@ -1106,18 +1034,6 @@ gtk_cmclist_get_arg (GObject *object,
     case ARG_SORT_TYPE:
       g_value_set_enum(value, clist->sort_type);
       break;
-#if GTK_CHECK_VERSION(3, 0, 0)
-    case ARG_HADJUSTMENT:
-      g_value_set_object(value, gtk_cmclist_get_hadjustment(clist));
-      break;
-    case ARG_VADJUSTMENT:
-      g_value_set_object(value, gtk_cmclist_get_vadjustment(clist));
-      break;
-    case ARG_HADJUSTMENT_POLICY:
-    case ARG_VADJUSTMENT_POLICY:
-      g_value_set_enum(value, GTK_SCROLL_NATURAL);
-      break;
-#endif
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, arg_id, spec);
       break;
@@ -1349,7 +1265,6 @@ gtk_cmclist_get_vadjustment (GtkCMCList *clist)
   return clist->vadjustment;
 }
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
 static void
 gtk_cmclist_set_scroll_adjustments (GtkCMCList      *clist,
                                  GtkAdjustment *hadjustment,
@@ -1360,7 +1275,6 @@ gtk_cmclist_set_scroll_adjustments (GtkCMCList      *clist,
   if (clist->vadjustment != vadjustment)
     gtk_cmclist_set_vadjustment (clist, vadjustment);
 }
-#endif
 
 void
 gtk_cmclist_set_shadow_type (GtkCMCList      *clist,
@@ -3366,11 +3280,9 @@ gtk_cmclist_set_foreground (GtkCMCList       *clist,
     {
       clist_row->foreground = *color;
       clist_row->fg_set = TRUE;
-#if !GTK_CHECK_VERSION(3, 0, 0)
       if (gtk_widget_get_realized (GTK_WIDGET(clist)))
        gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (clist)),
                         &clist_row->foreground, TRUE, TRUE);
-#endif
     }
   else
     clist_row->fg_set = FALSE;
@@ -3397,11 +3309,9 @@ gtk_cmclist_set_background (GtkCMCList       *clist,
     {
       clist_row->background = *color;
       clist_row->bg_set = TRUE;
-#if !GTK_CHECK_VERSION(3, 0, 0)
       if (gtk_widget_get_realized (GTK_WIDGET(clist)))
        gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (clist)),
                         &clist_row->background, TRUE, TRUE);
-#endif
     }
   else
     clist_row->bg_set = FALSE;
@@ -4509,11 +4419,7 @@ sync_selection (GtkCMCList *clist,
  *   gtk_cmclist_finalize
  */
 static void
-#if !GTK_CHECK_VERSION(3, 0, 0)
 gtk_cmclist_destroy (GtkObject *object)
-#else
-gtk_cmclist_destroy (GtkWidget *object)
-#endif
 {
   gint i;
   GtkCMCList *clist;
@@ -4561,13 +4467,8 @@ gtk_cmclist_destroy (GtkWidget *object)
        clist->column[i].button = NULL;
       }
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
   if (GTK_OBJECT_CLASS (gtk_cmclist_parent_class)->destroy)
     (*GTK_OBJECT_CLASS (gtk_cmclist_parent_class)->destroy) (object);
-#else
-  if (GTK_WIDGET_CLASS (gtk_cmclist_parent_class)->destroy)
-    (*GTK_WIDGET_CLASS (gtk_cmclist_parent_class)->destroy) (object);
-#endif
 }
 
 static void
@@ -4629,19 +4530,13 @@ gtk_cmclist_realize (GtkWidget *widget)
   attributes.height = allocation.height - border_width * 2;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = gtk_widget_get_visual (widget);
-#if !GTK_CHECK_VERSION(3, 0, 0)
   attributes.colormap = gtk_widget_get_colormap (widget);
-#endif
   attributes.event_mask = gtk_widget_get_events (widget);
   attributes.event_mask |= (GDK_EXPOSURE_MASK |
                            GDK_BUTTON_PRESS_MASK |
                            GDK_BUTTON_RELEASE_MASK |
                            GDK_KEY_RELEASE_MASK);
-#if !GTK_CHECK_VERSION(3, 0, 0)
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-#else
-  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-#endif
 
   /* main window */
   window = gdk_window_new (gtk_widget_get_parent_window (widget),
@@ -4737,7 +4632,6 @@ gtk_cmclist_realize (GtkWidget *widget)
        clist_row->style = gtk_style_attach (clist_row->style,
                                             clist->clist_window);
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
       if (clist_row->fg_set || clist_row->bg_set)
        {
          GdkColormap *colormap;
@@ -4748,8 +4642,7 @@ gtk_cmclist_realize (GtkWidget *widget)
          if (clist_row->bg_set)
            gdk_colormap_alloc_color (colormap, &clist_row->background, TRUE, TRUE);
        }
-#endif
-      
+
       for (j = 0; j < clist->columns; j++)
        if  (clist_row->cell[j].style)
          clist_row->cell[j].style =
@@ -4919,15 +4812,9 @@ gtk_cmclist_unmap (GtkWidget *widget)
     }
 }
 
-#if !GTK_CHECK_VERSION(3, 0, 0)
 static gint
 gtk_cmclist_expose (GtkWidget      *widget,
                  GdkEventExpose *event)
-#else
-static gint
-gtk_cmclist_expose (GtkWidget *widget,
-          cairo_t *event)
-#endif
 {
   GtkCMCList *clist;
 
@@ -4939,40 +4826,19 @@ gtk_cmclist_expose (GtkWidget *widget,
       clist = GTK_CMCLIST (widget);
 
       /* exposure events on the list */
-#if !GTK_CHECK_VERSION(3, 0, 0)
       if (event->window == clist->clist_window)
        draw_rows (clist, &event->area);
-#else
-      if (gtk_cairo_should_draw_window (event, clist->clist_window))
-        {
-       GdkRectangle area;
 
-       /* FIXME: get proper area */
-       if (gdk_cairo_get_clip_rectangle (event, &area))
-         draw_rows (clist, &area);
-        }
-#endif
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
       if (event->window == clist->title_window)
-#else
-      if (gtk_cairo_should_draw_window (event, clist->title_window))
-#endif
        {
          gint i;
          
          for (i = 0; i < clist->columns; i++)
            {
              if (clist->column[i].button) {
-#if !GTK_CHECK_VERSION(3, 0, 0)
                gtk_container_propagate_expose (GTK_CONTAINER (clist),
                                                clist->column[i].button,
                                                event);
-#else
-               gtk_container_propagate_draw (GTK_CONTAINER (clist),
-                                               clist->column[i].button,
-                                               event);
-#endif
              }
            }
        }
@@ -5501,32 +5367,6 @@ gtk_cmclist_motion (GtkWidget      *widget,
   return FALSE;
 }
 
-#if GTK_CHECK_VERSION(3, 0, 0)
-static void
-gtk_cmclist_get_preferred_width (GtkWidget *widget,
-                                 gint      *minimal_width,
-                                 gint      *natural_width)
-{
-  GtkRequisition requisition;
-
-  gtk_cmclist_size_request (widget, &requisition);
-
-  *minimal_width = *natural_width = requisition.width;
-}
-
-static void
-gtk_cmclist_get_preferred_height (GtkWidget *widget,
-                                  gint      *minimal_height,
-                                  gint      *natural_height)
-{
-  GtkRequisition requisition;
-
-  gtk_cmclist_size_request (widget, &requisition);
-
-  *minimal_height = *natural_height = requisition.height;
-}
-#endif
-
 static void
 gtk_cmclist_size_request (GtkWidget      *widget,
                        GtkRequisition *requisition)