Elm entry: Fixed 'Paste' to only show if there clipboard isn't empty.
[framework/uifw/elementary.git] / src / lib / elm_cnp_helper.c
index ad9a51f..96b3b07 100644 (file)
@@ -168,14 +168,14 @@ static void entry_insert_filter(Evas_Object* entry, char* str);
 /* Optimisation: Turn this into a 256 byte table:
  *     then can lookup in one index, not N checks */
 static const Escape escapes[] = {
-       { "<br>",   '\n' },
-       { "<ps>",   '\n' },
-       { "<\t>",   '\t' },
-       { "gt;",    '>'  },
-       { "lt;",    '<'  },
-       { "amp;",   '&'  },
-       { "quot;",  '\'' },
-       { "dquot;", '"'  }
+  { "<br>",   '\n' },
+  { "<ps>",   '\n' },
+  { "<\t>",   '\t' },
+  { "gt;",    '>'  },
+  { "lt;",    '<'  },
+  { "amp;",   '&'  },
+  { "quot;",  '\'' },
+  { "dquot;", '"'  }
 };
 #define N_ESCAPES ((int)(sizeof(escapes) / sizeof(escapes[0])))
 
@@ -1181,6 +1181,16 @@ _convert_to_edje(Eina_List* nodes)
 }
 
 Eina_Bool
+elm_selection_selection_has_owner(void)
+{
+#ifdef HAVE_ELEMENTARY_X
+   return !!ecore_x_selection_owner_get(clipboard_atom);
+#else
+   return EINA_FALSE;
+#endif
+}
+
+Eina_Bool
 elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *selbuf)
 {
 #ifdef HAVE_ELEMENTARY_X
@@ -1461,11 +1471,13 @@ notify_handler_targets(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notif
           {
              if ((atoms[j].atom == atomlist[i]) && (atoms[j].notify))
                {
-/*                  if ((j == CNP_ATOM_text_uri) ||
+#if 0
+                  if ((j == CNP_ATOM_text_uri) ||
                       (j == CNP_ATOM_text_urilist))
                     {
                       if(!is_uri_type_data(sel, notify)) continue;
-                    }*/
+                    }
+#endif
                   cnp_debug("Atom %s matches\n",atoms[j].name);
                   goto done;
                }