You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
4.6 KiB
164 lines
4.6 KiB
#ifndef UBL_UTILS
|
|
#define UBL_UTILS
|
|
#include <pthread.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <pthread.h>
|
|
#include <string.h>
|
|
#include <dirent.h>
|
|
#include <locale.h>
|
|
#include <gtk/gtk.h>
|
|
#include <gtk/gtkx.h>
|
|
|
|
#define DesktopPath "/usr/share/applications/"
|
|
|
|
#define for_dictionaries(obj,obj1) for(obj=obj1->first;obj!=NULL;obj=obj->next)
|
|
|
|
typedef enum {
|
|
DICTIONARY_ACTION_WIDGETS_TYPE,
|
|
DICTIONARY_IVGRAPHICALS_TYPE,
|
|
DICTIONARY_OTHER_TYPE
|
|
|
|
} DICT_TYPE;
|
|
|
|
|
|
typedef struct {
|
|
char *command;
|
|
int *exitcode;
|
|
} thread_output;
|
|
|
|
typedef struct dictionary {
|
|
char *key;
|
|
void *data;
|
|
struct dictionary *next;
|
|
struct dictionary *prev;
|
|
struct dictionary *first;
|
|
DICT_TYPE data_type;
|
|
} dictionary;
|
|
|
|
typedef struct apps{
|
|
char *Name;
|
|
int Type;
|
|
char *Categories;
|
|
char *Exec;
|
|
char *Icon;
|
|
int Pluggable;
|
|
int DualPluggable;
|
|
} apps;
|
|
|
|
|
|
//dictionary functions
|
|
|
|
dictionary *yon_dictionary_create_empty();
|
|
|
|
dictionary * yon_dictionary_create_conneced(dictionary *targetdict);
|
|
|
|
dictionary *yon_dictionary_get_last(dictionary *dict);
|
|
|
|
dictionary *yon_dictionary_switch_places(dictionary *dict,int aim);
|
|
|
|
void yon_dictionary_make_first(dictionary *dict);
|
|
|
|
void yon_dictionary_make_nth(dictionary *dict, int nth);
|
|
|
|
dictionary *yon_dictionary_create_with_data(char *key, void *data);
|
|
|
|
dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data);
|
|
|
|
dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect);
|
|
|
|
dictionary *yon_dictionary_find(dictionary **dict, char *key);
|
|
|
|
dictionary *yon_dictionary_rip(dictionary *dict);
|
|
|
|
dictionary *yon_dictionary_get_nth(dictionary *dict, int place);
|
|
|
|
//char functions
|
|
|
|
char *yon_char_get_augumented(char *source, char *append);
|
|
|
|
char *yon_char_new(char *chr);
|
|
|
|
char *yon_cut(char *source, int size, int startpos);
|
|
|
|
char *yon_char_divide(char *source, int dividepos);
|
|
|
|
char *yon_char_divide_search(char *source, char* dividepos, int delete_divider);
|
|
|
|
char *yon_char_from_int(int int_to_convert);
|
|
|
|
|
|
|
|
//parsing functions
|
|
|
|
apps *yon_apps_scan_and_parse_desktops(int *sizef);
|
|
|
|
|
|
void yon_apps_sort(apps *applist,int size);
|
|
|
|
|
|
apps *yon_apps_get_by_name(apps *applist,char *name, int size);
|
|
|
|
|
|
//terminal-using functions
|
|
|
|
|
|
|
|
int yon_launch_app(char *name);
|
|
|
|
|
|
int yon_launch_app_with_arguments(char *name, char *args);
|
|
|
|
|
|
int yon_launch(thread_output *thread);
|
|
|
|
//Gtk functions
|
|
|
|
#ifdef __GTK_H__
|
|
|
|
#define yon_gtk_builder_get_widget(obj,obj2) GTK_WIDGET(gtk_builder_get_object(obj,obj2))
|
|
|
|
|
|
typedef struct {
|
|
GtkWidget *Icon;
|
|
GtkWidget *Label;
|
|
GtkWidget *IconView;
|
|
GtkListStore *List;
|
|
} expander_icon_view;
|
|
|
|
|
|
// GtkWidget *yon_gtk_app_chooser_apps_create();
|
|
|
|
// dictionary *yon_gtk_app_chooser_create();
|
|
|
|
// expander_icon_view yon_gtk_icon_view_expander_create(GtkWidget *pack, ...);
|
|
|
|
GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data);
|
|
|
|
int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment);
|
|
|
|
int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding);
|
|
int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding);
|
|
|
|
//uninitialised
|
|
|
|
void yon_on_plug_added(GtkSocket* self, gpointer user_data);
|
|
void yon_on_plug_removed(GtkSocket* self, gpointer user_data);
|
|
|
|
|
|
#endif
|
|
typedef enum {
|
|
BACKGROUND_IMAGE_SUCCESS_TYPE,
|
|
BACKGROUND_IMAGE_FAIL_TYPE
|
|
} BACKGROUND_IMAGE_TYPE;
|
|
#ifdef __cplusplus
|
|
#define yon_ubl_header_setup(overlay,head,image,imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()),GTK_WIDGET(head.gobj()),GTK_WIDGET(image.gobj()),(char*)imag_path)
|
|
#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(GTK_WIDGET(statusbox.gobj()), GTK_WIDGET(statusicon.gobj()), GTK_WIDGET(statuslabel.gobj()), (char*)iconname, (char*)statustext, backgroundclass)
|
|
#else
|
|
#define yon_ubl_header_setup(overlay,head,image,imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay),GTK_WIDGET(head),GTK_WIDGET(image), (char*)imag_path)
|
|
#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass)
|
|
#endif
|
|
|
|
void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path);
|
|
void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *IconName, char* StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass);
|
|
#endif |