summaryrefslogtreecommitdiff
blob: 197f850b3a8e7674d2a5c2ea0da5f8644c3adaf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
From 9042e70bf7c8266aef059114d27ec1764fc41466 Mon Sep 17 00:00:00 2001
From: Nick Schermer <nick@xfce.org>
Date: Tue, 21 Jun 2011 19:55:19 +0000
Subject: Drop XfceDesktopEntry usage.

---
diff --git a/libxfcegui4/xfce-appmenuitem.c b/libxfcegui4/xfce-appmenuitem.c
index 20dfa06..ffb15ed 100644
--- a/libxfcegui4/xfce-appmenuitem.c
+++ b/libxfcegui4/xfce-appmenuitem.c
@@ -522,127 +522,17 @@ GtkWidget *xfce_app_menu_item_new_full(const gchar *label, const gchar *command,
  * xfce_app_menu_item_new_with_command(), xfce_app_menu_item_set_needs_term(),
  * xfce_app_menu_item_set_icon_name(), and
  * xfce_app_menu_item_set_startup_notification().
+ * 
+ * In Xfce 4.10 this function only returns NULL, since XfceDesktopEntry was
+ * removed from libxfce4util.
  *
  * Since 4.1
  **/
 GtkWidget *
-xfce_app_menu_item_new_from_desktop_entry(XfceDesktopEntry *entry,
+xfce_app_menu_item_new_from_desktop_entry(gpointer *entry,
         gboolean show_icon)
 {
-    XfceAppMenuItem *app_menu_item;
-    gchar *name = NULL, *cmd = NULL, *icon = NULL, *snotify = NULL;
-    gchar *onlyshowin = NULL, *categories = NULL, *term = NULL;
-    const gchar *dfile;
-    
-    g_return_val_if_fail(XFCE_IS_DESKTOP_ENTRY(entry), NULL);
-    
-    if(xfce_desktop_entry_get_string(entry, "OnlyShowIn", FALSE, &onlyshowin)
-       || xfce_desktop_entry_get_string(entry, "Categories", FALSE,
-                                        &categories))
-    {
-        if((onlyshowin && strstr(onlyshowin, "XFCE;"))
-           || (categories && strstr(categories, "X-XFCE;")))
-        {
-            if(xfce_desktop_entry_has_translated_entry(entry, "GenericName")) {
-                xfce_desktop_entry_get_string(entry, "GenericName", TRUE,
-                                              &name);
-            } else if(xfce_desktop_entry_has_translated_entry(entry, "Name")) {
-                xfce_desktop_entry_get_string(entry, "Name", TRUE, &name);
-            } else {
-                xfce_desktop_entry_get_string(entry, "GenericName", FALSE,
-                                              &name);
-            }
-        } else if(onlyshowin) {
-            g_free(onlyshowin);
-            g_free(categories);
-            return NULL;
-        }
-        
-        g_free(onlyshowin);
-        g_free(categories);
-    }
-    
-    app_menu_item = XFCE_APP_MENU_ITEM(xfce_app_menu_item_new());
-    
-    if(!name && !xfce_desktop_entry_get_string(entry, "Name", TRUE, &name)) {
-        gchar *tmp, *tmp1;
-        
-        tmp = g_filename_to_utf8(xfce_desktop_entry_get_file(entry), -1,
-                                 NULL, NULL, NULL);
-        if(!tmp)
-            tmp = g_strdup(xfce_desktop_entry_get_file(entry));
-            
-        if((tmp1 = g_strrstr(tmp, ".desktop")))
-            *tmp1 = 0;
-        if((tmp1 = g_strrstr(tmp, "/")))
-            tmp1++;
-        else
-            tmp1 = name;
-        name = g_strdup(tmp1);
-        g_free(tmp);
-    }
-    
-    app_menu_item->priv->name = name;
-    
-    if(!g_utf8_validate(name, -1, NULL)) {
-        g_warning("XfceAppMenuItem: 'name' failed utf8 validation for .desktop file '%s'",
-                xfce_desktop_entry_get_file(entry));
-        gtk_widget_destroy(GTK_WIDGET(app_menu_item));
-        return NULL;
-    }
-    
-    gtk_label_set_text(GTK_LABEL(app_menu_item->priv->accel_label),
-                       app_menu_item->priv->name);
-    
-    if(xfce_desktop_entry_get_string(entry, "Terminal", TRUE, &term)) {
-        app_menu_item->priv->needs_term = (*term == '1'
-                                           || !g_ascii_strcasecmp(term,
-                                                                  "true"));
-        g_free(term);
-    }
-    
-    if(xfce_desktop_entry_get_string(entry, "StartupNotify", TRUE, &snotify)) {
-        app_menu_item->priv->snotify = (*snotify == '1'
-                                        || !g_ascii_strcasecmp(snotify,
-                                                               "true"));
-        g_free(snotify);
-    }
-    
-    if(!xfce_desktop_entry_get_string(entry, "Exec", TRUE, &cmd)) {
-        gtk_widget_destroy(GTK_WIDGET(app_menu_item));
-        return NULL;
-    }
-
-    /* remove quotes around the command (yes, people do that!) */
-    if(cmd[0] == '"') {
-        gint i;
-        
-        for(i = 1; cmd[i - 1] != '\0'; ++i) {
-            if (cmd[i] != '"')
-                cmd[i-1] = cmd[i];
-            else {
-                cmd[i-1] = cmd[i] = ' ';
-                break;
-            }
-        }
-    }
-
-    app_menu_item->priv->command = xfce_expand_variables(cmd, NULL);
-    g_free(cmd);
-    
-    if(show_icon) {
-        xfce_desktop_entry_get_string(entry, "Icon", TRUE, &icon);
-        if(icon) {
-            xfce_app_menu_item_set_icon_name(app_menu_item, icon);
-            g_free(icon);
-        }
-    }
-    
-    dfile = xfce_desktop_entry_get_file(entry);
-    if(dfile)
-        app_menu_item->priv->dot_desktop_filename = g_strdup(dfile);
-    
-    return GTK_WIDGET(app_menu_item);
+    return NULL;
 }
 
 /**
diff --git a/libxfcegui4/xfce-appmenuitem.h b/libxfcegui4/xfce-appmenuitem.h
index 5732af9..0ce0f29 100644
--- a/libxfcegui4/xfce-appmenuitem.h
+++ b/libxfcegui4/xfce-appmenuitem.h
@@ -70,7 +70,7 @@ GtkWidget *xfce_app_menu_item_new_full                (const gchar *label,
                                                        gboolean needs_term,
                                                        gboolean snotify);
 
-GtkWidget *xfce_app_menu_item_new_from_desktop_entry  (XfceDesktopEntry *entry,
+GtkWidget *xfce_app_menu_item_new_from_desktop_entry  (gpointer *entry,
                                                        gboolean show_icon);
 
 void xfce_app_menu_item_set_name                      (XfceAppMenuItem *app_menu_item,
--
cgit v0.9.0.3