1 /* 2 * application-button: A button representing an application 3 * (either by menu item or desktop file) 4 * 5 * Copyright 2012-2020 Stephan Haller <nomad@froevel.de> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 20 * MA 02110-1301, USA. 21 * 22 * 23 */ 24 25 #ifndef __LIBXFDASHBOARD_APPLICATION_BUTTON__ 26 #define __LIBXFDASHBOARD_APPLICATION_BUTTON__ 27 28 #if !defined(__LIBXFDASHBOARD_H_INSIDE__) && !defined(LIBXFDASHBOARD_COMPILATION) 29 #error "Only <libxfdashboard/libxfdashboard.h> can be included directly." 30 #endif 31 32 #include <garcon/garcon.h> 33 34 #include <libxfdashboard/button.h> 35 #include <libxfdashboard/desktop-app-info.h> 36 #include <libxfdashboard/popup-menu.h> 37 38 G_BEGIN_DECLS 39 40 #define XFDASHBOARD_TYPE_APPLICATION_BUTTON (xfdashboard_application_button_get_type()) 41 #define XFDASHBOARD_APPLICATION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_APPLICATION_BUTTON, XfdashboardApplicationButton)) 42 #define XFDASHBOARD_IS_APPLICATION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_APPLICATION_BUTTON)) 43 #define XFDASHBOARD_APPLICATION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFDASHBOARD_TYPE_APPLICATION_BUTTON, XfdashboardApplicationButtonClass)) 44 #define XFDASHBOARD_IS_APPLICATION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFDASHBOARD_TYPE_APPLICATION_BUTTON)) 45 #define XFDASHBOARD_APPLICATION_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFDASHBOARD_TYPE_APPLICATION_BUTTON, XfdashboardApplicationButtonClass)) 46 47 typedef struct _XfdashboardApplicationButton XfdashboardApplicationButton; 48 typedef struct _XfdashboardApplicationButtonClass XfdashboardApplicationButtonClass; 49 typedef struct _XfdashboardApplicationButtonPrivate XfdashboardApplicationButtonPrivate; 50 51 struct _XfdashboardApplicationButton 52 { 53 /*< private >*/ 54 /* Parent instance */ 55 XfdashboardButton parent_instance; 56 57 /* Private structure */ 58 XfdashboardApplicationButtonPrivate *priv; 59 }; 60 61 struct _XfdashboardApplicationButtonClass 62 { 63 /*< private >*/ 64 /* Parent class */ 65 XfdashboardButtonClass parent_class; 66 67 /*< public >*/ 68 /* Virtual functions */ 69 }; 70 71 /* Public API */ 72 GType xfdashboard_application_button_get_type(void) G_GNUC_CONST; 73 74 ClutterActor* xfdashboard_application_button_new(void); 75 ClutterActor* xfdashboard_application_button_new_from_app_info(GAppInfo *inAppInfo); 76 77 GAppInfo* xfdashboard_application_button_get_app_info(XfdashboardApplicationButton *self); 78 void xfdashboard_application_button_set_app_info(XfdashboardApplicationButton *self, 79 GAppInfo *inAppInfo); 80 81 gboolean xfdashboard_application_button_get_show_description(XfdashboardApplicationButton *self); 82 void xfdashboard_application_button_set_show_description(XfdashboardApplicationButton *self, 83 gboolean inShowDescription); 84 85 const gchar* xfdashboard_application_button_get_format_title_only(XfdashboardApplicationButton *self); 86 void xfdashboard_application_button_set_format_title_only(XfdashboardApplicationButton *self, 87 const gchar *inFormat); 88 89 const gchar* xfdashboard_application_button_get_format_title_description(XfdashboardApplicationButton *self); 90 void xfdashboard_application_button_set_format_title_description(XfdashboardApplicationButton *self, 91 const gchar *inFormat); 92 93 const gchar* xfdashboard_application_button_get_display_name(XfdashboardApplicationButton *self); 94 const gchar* xfdashboard_application_button_get_icon_name(XfdashboardApplicationButton *self); 95 96 gboolean xfdashboard_application_button_execute(XfdashboardApplicationButton *self, GAppLaunchContext *inContext); 97 98 guint xfdashboard_application_button_add_popup_menu_items_for_windows(XfdashboardApplicationButton *self, 99 XfdashboardPopupMenu *inMenu); 100 guint xfdashboard_application_button_add_popup_menu_items_for_actions(XfdashboardApplicationButton *self, 101 XfdashboardPopupMenu *inMenu); 102 103 G_END_DECLS 104 105 #endif /* __LIBXFDASHBOARD_APPLICATION_BUTTON__ */ 106