~ps-jenkins/ubuntu-push/ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to click/cappinfo/cappinfo.go

  • Committer: Roberto Alsina
  • Date: 2014-10-24 14:05:51 UTC
  • mfrom: (91.179.41 automatic)
  • mto: This revision was merged to the branch mainline in revision 136.
  • Revision ID: roberto.alsina@canonical.com-20141024140551-tsdz3xggo2rbwlqj
MergeĀ fromĀ automatic

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
   g_free (desktop_id);
38
38
   return filename;
39
39
}
 
40
 
 
41
gchar* app_symbolic_icon_from_desktop_id (gchar* desktop_id) {
 
42
    gchar* x_symbolic_icon;
 
43
    GIcon* symbolic_icon;
 
44
    GDesktopAppInfo* app_info = g_desktop_app_info_new (desktop_id);
 
45
    if (app_info != NULL) {
 
46
        if((x_symbolic_icon = g_desktop_app_info_get_string(app_info, "X-Ubuntu-SymbolicIcon"))) {
 
47
            GFile *file;
 
48
            file = g_file_new_for_path(x_symbolic_icon);
 
49
            symbolic_icon = g_file_icon_new (file);
 
50
            g_object_unref (file);
 
51
            g_free(x_symbolic_icon);
 
52
            g_object_unref (app_info);
 
53
            return g_icon_to_string(symbolic_icon);
 
54
        }
 
55
        g_object_unref (app_info);
 
56
    }
 
57
    g_free (desktop_id);
 
58
    return NULL;
 
59
}
40
60
*/
41
61
import "C"
42
62
 
45
65
        defer C.g_free((C.gpointer)(name))
46
66
        return C.GoString((*C.char)(name))
47
67
}
 
68
 
 
69
func appSymbolicIconFromDesktopId(desktopId string) string {
 
70
        name := C.app_symbolic_icon_from_desktop_id((*C.gchar)(C.CString(desktopId)))
 
71
        if name == nil {
 
72
                return ""
 
73
        }
 
74
        defer C.g_free((C.gpointer)(name))
 
75
        return C.GoString((*C.char)(name))
 
76
}
 
77
 
 
78
var AppSymbolicIconFromDesktopId = appSymbolicIconFromDesktopId