]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkselection.c
Bug 555186 – Setting gtk-toolbar-icon-size with custom icon_size
[~andy/gtk] / gtk / gtkselection.c
index 65350e84f36604f6005e6831c8aeb3fc4464d5a8..8ea2a3c93ae3c877215a365b4337b4aafc81b402 100644 (file)
@@ -51,7 +51,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include <config.h>
+#include "config.h"
 #include <stdarg.h>
 #include <string.h>
 #include "gdk.h"
@@ -1008,7 +1008,7 @@ gtk_selection_remove_all (GtkWidget *widget)
        In emergency, you could use #GDK_CURRENT_TIME
  * 
  * Requests the contents of a selection. When received, 
- * a "selection_received" signal will be generated.
+ * a "selection-received" signal will be generated.
  * 
  * Return value: %TRUE if requested succeeded. %FALSE if we could not process
  *          request. (e.g., there was already a request in process for
@@ -1067,6 +1067,7 @@ gtk_selection_convert (GtkWidget *widget,
   if (owner_window != NULL)
     {
       GtkWidget *owner_widget;
+      gpointer owner_widget_ptr;
       GtkSelectionData selection_data;
       
       selection_data.selection = selection;
@@ -1075,7 +1076,8 @@ gtk_selection_convert (GtkWidget *widget,
       selection_data.length = -1;
       selection_data.display = display;
       
-      gdk_window_get_user_data (owner_window, (gpointer *)&owner_widget);
+      gdk_window_get_user_data (owner_window, &owner_widget_ptr);
+      owner_widget = owner_widget_ptr;
       
       if (owner_widget != NULL)
        {
@@ -1110,20 +1112,21 @@ gtk_selection_convert (GtkWidget *widget,
 }
 
 /**
- * gtk_selection_data_set_target:
+ * gtk_selection_data_get_selection:
  * @selection_data: a pointer to a #GtkSelectionData structure.
- * @target: target of the selection
  *
- * Sets the target of the selection.
+ * Retrieves the selection #GdkAtom of the selection data.
  *
- * Since: GSEAL-branch
+ * Returns: the selection #GdkAtom of the selection data.
+ *
+ * Since: 2.16
  **/
-void gtk_selection_data_set_target (GtkSelectionData     *selection_data,
-                                   GdkAtom              target)
+GdkAtom
+gtk_selection_data_get_selection (GtkSelectionData *selection_data)
 {
-  g_return_if_fail (selection_data != NULL);
+  g_return_val_if_fail (selection_data != NULL, 0);
 
-  selection_data->target = target;
+  return selection_data->selection;
 }
 
 /**
@@ -1132,106 +1135,66 @@ void gtk_selection_data_set_target (GtkSelectionData     *selection_data,
  *
  * Retrieves the target of the selection.
  *
- * Since: GSEAL-branch
+ * Returns:  the target of the selection.
+ *
+ * Since: 2.14
  **/
-GdkAtom gtk_selection_data_get_target (GtkSelectionData     *selection_data)
+GdkAtom
+gtk_selection_data_get_target (GtkSelectionData *selection_data)
 {
   g_return_val_if_fail (selection_data != NULL, 0);
 
   return selection_data->target;
 }
 
-/**
- * gtk_selection_data_set_data_type:
- * @selection_data: a pointer to a #GtkSelectionData structure.
- * @data_type: data type of the selection
- *
- * Sets the data type of the selection.
- *
- * Since: GSEAL-branch
- **/
-void gtk_selection_data_set_data_type (GtkSelectionData     *selection_data,
-                                      GdkAtom              data_type)
-{
-  g_return_if_fail (selection_data != NULL);
-
-  selection_data->type = data_type;
-}
-
 /**
  * gtk_selection_data_get_data_type:
  * @selection_data: a pointer to a #GtkSelectionData structure.
  *
  * Retrieves the data type of the selection.
  *
- * Since: GSEAL-branch
+ * Returns:  the data type of the selection.
+ *
+ * Since: 2.14
  **/
-GdkAtom gtk_selection_data_get_data_type (GtkSelectionData     *selection_data)
+GdkAtom
+gtk_selection_data_get_data_type (GtkSelectionData *selection_data)
 {
   g_return_val_if_fail (selection_data != NULL, 0);
 
   return selection_data->type;
 }
 
-/**
- * gtk_selection_data_set_format:
- * @selection_data: a pointer to a #GtkSelectionData structure.
- * @format: format of the selection
- *
- * Sets the format of the selection.
- *
- * Since: GSEAL-branch
- **/
-void gtk_selection_data_set_format (GtkSelectionData     *selection_data,
-                                   gint                 format)
-{
-  g_return_if_fail (selection_data != NULL);
-
-  selection_data->format = format;
-}
-
 /**
  * gtk_selection_data_get_format:
  * @selection_data: a pointer to a #GtkSelectionData structure.
  *
  * Retrieves the format of the selection.
  *
- * Since: GSEAL-branch
+ * Returns: the format of the selection.
+ *
+ * Since: 2.14
  **/
-gint gtk_selection_data_get_format (GtkSelectionData     *selection_data)
+gint
+gtk_selection_data_get_format (GtkSelectionData *selection_data)
 {
   g_return_val_if_fail (selection_data != NULL, 0);
 
   return selection_data->format;
 }
 
-/**
- * gtk_selection_data_set_data:
- * @selection_data: a pointer to a #GtkSelectionData structure.
- * @data: data of the selection
- *
- * Sets the raw data of the selection.
- *
- * Since: GSEAL-branch
- **/
-void gtk_selection_data_set_data (GtkSelectionData     *selection_data,
-                                 const guchar         *data)
-{
-  g_return_if_fail (selection_data != NULL);
-
-  g_free (selection_data->data);
-  selection_data->data = (guchar*) g_strdup (data);
-}
-
 /**
  * gtk_selection_data_get_data:
  * @selection_data: a pointer to a #GtkSelectionData structure.
  *
  * Retrieves the raw data of the selection.
  *
- * Since: GSEAL-branch
+ * Returns: the raw data of the selection.
+ *
+ * Since: 2.14
  **/
-const guchar* gtk_selection_data_get_data (GtkSelectionData     *selection_data)
+const guchar*
+gtk_selection_data_get_data (GtkSelectionData *selection_data)
 {
   g_return_val_if_fail (selection_data != NULL, NULL);
 
@@ -1239,35 +1202,39 @@ const guchar* gtk_selection_data_get_data (GtkSelectionData     *selection_data)
 }
 
 /**
- * gtk_selection_data_set_target:
+ * gtk_selection_data_get_length:
  * @selection_data: a pointer to a #GtkSelectionData structure.
- * @length: length of the selection
  *
- * Sets the length of the selection.
+ * Retrieves the length of the raw data of the selection.
  *
- * Since: GSEAL-branch
- **/
-void gtk_selection_data_set_length (GtkSelectionData     *selection_data,
-                                   gint                 length)
+ * Returns: the length of the data of the selection.
+ *
+ * Since: 2.14
+ */
+gint
+gtk_selection_data_get_length (GtkSelectionData *selection_data)
 {
-  g_return_if_fail (selection_data != NULL);
+  g_return_val_if_fail (selection_data != NULL, -1);
 
-  selection_data->length = length;
+  return selection_data->length;
 }
 
 /**
- * gtk_selection_data_get_length:
+ * gtk_selection_data_get_display:
  * @selection_data: a pointer to a #GtkSelectionData structure.
  *
- * Retrieves the length of the selection.
+ * Retrieves the display of the selection.
+ *
+ * Returns: the display of the selection.
  *
- * Since: GSEAL-branch
+ * Since: 2.14
  **/
-gint gtk_selection_data_get_length (GtkSelectionData     *selection_data)
+GdkDisplay *
+gtk_selection_data_get_display (GtkSelectionData *selection_data)
 {
-  g_return_val_if_fail (selection_data != NULL, 0);
+  g_return_val_if_fail (selection_data != NULL, NULL);
 
-  return selection_data->length;
+  return selection_data->display;
 }
 
 /**
@@ -2697,7 +2664,7 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
 
 /*************************************************************
  * _gtk_selection_notify:
- *     Handler for "selection_notify_event" signals on windows
+ *     Handler for "selection-notify-event" signals on windows
  *     where a retrieval is currently in process. The selection
  *     owner has responded to our conversion request.
  *   arguments:
@@ -2786,7 +2753,7 @@ _gtk_selection_notify (GtkWidget         *widget,
 
 /*************************************************************
  * _gtk_selection_property_notify:
- *     Handler for "property_notify_event" signals on windows
+ *     Handler for "property-notify-event" signals on windows
  *     where a retrieval is currently in process. The selection
  *     owner has added more data.
  *   arguments:
@@ -2941,7 +2908,7 @@ gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
 
 /*************************************************************
  * gtk_selection_retrieval_report:
- *     Emits a "selection_received" signal.
+ *     Emits a "selection-received" signal.
  *   arguments:
  *     info:     information about the retrieval that completed
  *     buffer:   buffer containing data (NULL => errror)
@@ -2967,7 +2934,7 @@ gtk_selection_retrieval_report (GtkRetrievalInfo *info,
   data.display = gtk_widget_get_display (info->widget);
   
   g_signal_emit_by_name (info->widget,
-                        "selection_received", 
+                        "selection-received", 
                         &data, time);
 }
 
@@ -3002,7 +2969,7 @@ gtk_selection_invoke_handler (GtkWidget          *widget,
       gtk_target_list_find (target_list, data->target, &info))
     {
       g_signal_emit_by_name (widget,
-                            "selection_get",
+                            "selection-get",
                             data,
                             info, time);
     }