This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit 885c6f4833fb9a4675459ff6f9f760e77843f156
Author: Carsten Haitzler <[email protected]>
AuthorDate: Mon Jan 5 20:14:23 2026 +0000

    trim down header count and use single master header
    
    default config is also abstracted multiple levels with defines -> fields
    from a header... trim that too
---
 src/modules/clipboard/common.h          |  51 --------------
 src/modules/clipboard/config_defaults.h |  18 -----
 src/modules/clipboard/e_mod_config.h    |  46 -------------
 src/modules/clipboard/e_mod_main.c      |  81 +++++++++++-----------
 src/modules/clipboard/e_mod_main.h      | 117 +++++++++++++++++++++++++++-----
 src/modules/clipboard/history.h         |   9 ---
 src/modules/clipboard/utility.h         |  10 ---
 7 files changed, 139 insertions(+), 193 deletions(-)

diff --git a/src/modules/clipboard/common.h b/src/modules/clipboard/common.h
deleted file mode 100644
index 061f781cf..000000000
--- a/src/modules/clipboard/common.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef CLIPBOARD_COMMON_H
-#define CLIPBOARD_COMMON_H
-
-#include "e.h"
-#include "config.h"
-#include "e_mod_config.h"
-#include "history.h"
-#include "utility.h"
-
-#define MAGIC_LABEL_SIZE 50
-#define MAGIC_HIST_SIZE  20
-#define MAGIC_IGNORE_WS   0
-#define LABEL_MIN  5
-#define LABEL_MAX  100
-
-/* Stuff for convenience to compress code */
-#define IF_TRUE_RETURN(exp)             \
-do {                                    \
-  if (exp) return;                      \
-} while(0)
-
-typedef struct _Clip_Data
-{ // structure used for storing clipboard data in
-  char *name;
-  char *content;
-} Clip_Data;
-
-typedef struct _Instance Instance;
-struct _Instance
-{
-  E_Gadcon_Client *gcc;
-  Evas_Object *o_button;
-  Evas_Object *table;
-  E_Gadcon_Popup *popup;
-};
-
-typedef struct _Mod_Inst Mod_Inst;
-struct _Mod_Inst
-{ // sructure to store a global module instance in
-  // complete with a hidden window for event notification purposes
-  Instance *inst;
-  Evas_Object *ewin; // window to send clipboard events to
-  Eina_List *handle; // for handling clipboard events
-  Eina_List *items; // clipboard history
-  Elm_Sel_Type sel_type; // type of sel we last saw change
-};
-
-void       cb_mod_log(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
-extern int clipboard_log;
-void       free_clip_data(Clip_Data *clip);
-#endif
diff --git a/src/modules/clipboard/config_defaults.h b/src/modules/clipboard/config_defaults.h
deleted file mode 100644
index b8f66b26f..000000000
--- a/src/modules/clipboard/config_defaults.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef CONFIG_DEFAULTS_H
-#define CONFIG_DEFAULTS_H
-
-// configuration defaults
-#define  CF_DEFAULT_COPY            1
-#define  CF_DEFAULT_SELECT          0
-#define  CF_DEFAULT_SYNC            0
-#define  CF_DEFAULT_PERSISTANCE     1
-#define  CF_DEFAULT_HIST_REVERSE    0
-#define  CF_DEFAULT_HIST_ITEMS      MAGIC_HIST_SIZE
-#define  CF_DEFAULT_LABEL_LENGTH    MAGIC_LABEL_SIZE
-#define  CF_DEFAULT_IGNORE_WS       MAGIC_IGNORE_WS
-#define  CF_DEFAULT_IGNORE_WS_COPY  0
-#define  CF_DEFAULT_WS              0
-#define  CF_DEFAULT_NL              0
-#define  CF_DEFAULT_CONFIRM         1
-
-#endif
diff --git a/src/modules/clipboard/e_mod_config.h b/src/modules/clipboard/e_mod_config.h
deleted file mode 100644
index 8edaa1771..000000000
--- a/src/modules/clipboard/e_mod_config.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef E_MOD_CONFIG_H
-#define E_MOD_CONFIG_H
-
-#define HIST_MIN   5
-#define HIST_MAX   100
-
-/* We create a structure config for our module, and also a config structure
- * for every item element (you can have multiple gadgets for the same module) */
-typedef struct _Config Config;
-typedef struct _Config_Item Config_Item;
-
-struct _Config
-{
-  Eina_List *items;
-  E_Module *module;
-  E_Config_Dialog *config_dialog;
-  const char *log_name;
-  Eina_Bool label_length_changed;  /* Flag indicating a need to update all clip
-                                       labels as configfuration changed. */
-
-  int version;          /* Configuration version                           */
-  unsigned int hist_items;   /* Number of history items to store                */
-  unsigned int label_length; /* Number of characters of item to display         */
-  // these are booleans really...
-  int clip_copy;        /* Clipboard to use                                */
-  int clip_select;      /* Clipboard to use                                */
-  int persistence;      /* History file persistance                        */
-  int hist_reverse;     /* Order to display History                        */
-  int confirm_clear;    /* Display history confirmation dialog on deletion */
-  int ignore_ws;        /* Should we ignore White space in label           */
-  int ignore_ws_copy;   /* Should we not copy White space only             */
-  int trim_ws;          /* Should we trim White space from selection       */
-  int trim_nl;          /* Should we trim new lines from selection         */
-};
-
-struct _Config_Item
-{
-  const char *id;
-};
-
-extern Config *clip_cfg;
-
-E_Config_Dialog *config_clipboard_module(Evas_Object *parent, const char *params EINA_UNUSED);
-Eet_Error        truncate_history(const unsigned int n);
-
-#endif
diff --git a/src/modules/clipboard/e_mod_main.c b/src/modules/clipboard/e_mod_main.c
index b47c54d9f..e0efe01ff 100644
--- a/src/modules/clipboard/e_mod_main.c
+++ b/src/modules/clipboard/e_mod_main.c
@@ -1,12 +1,9 @@
 #include "e_mod_main.h"
-#include "config_defaults.h"
 
-/* Stuff for convenience to compress code */
+// Stuff for convenience to compress code
 #define CLIP_TRIM_MODE(x) (x->trim_nl + 2 * (x->trim_ws))
-#define MOUSE_BUTTON ECORE_EVENT_MOUSE_BUTTON_DOWN
-typedef Evas_Event_Mouse_Down Mouse_Event;
 
-/* gadcon requirements */
+// gadcon requirements
 static     Evas_Object  *_gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas * evas);
 static const char       *_gc_id_new(const E_Gadcon_Client_Class *client_class);
 static E_Gadcon_Client  *_gc_init(E_Gadcon * gc, const char *name, const char *id, const char *style);
@@ -15,14 +12,15 @@ static const char       *_gc_label(const E_Gadcon_Client_Class *client_class EIN
 static void              _gc_shutdown(E_Gadcon_Client * gcc);
 
 /* Define the gadcon class that this module provides (just 1) */
-static const E_Gadcon_Client_Class _gadcon_class = {
-   GADCON_CLIENT_CLASS_VERSION,
-   "clipboard",
-   {
-      _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
-      e_gadcon_site_is_not_toolbar
-   },
-   E_GADCON_CLIENT_STYLE_PLAIN
+static const E_Gadcon_Client_Class _gadcon_class =
+{
+  GADCON_CLIENT_CLASS_VERSION,
+  "clipboard",
+  {
+    _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
+    e_gadcon_site_is_not_toolbar
+  },
+  E_GADCON_CLIENT_STYLE_PLAIN
 };
 
 /* Set the version and the name IN the code (not just the .desktop file)
@@ -30,28 +28,29 @@ static const E_Gadcon_Client_Class _gadcon_class = {
  * modules that are compiled for an incorrect API version safely */
 E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Clipboard"};
 
-/* actual module specifics   */
+// actual module specifics
 Config *clip_cfg = NULL;
+Mod_Inst *clip_inst = NULL; // Need by e_mod_config.c
+
 static E_Config_DD *conf_edd = NULL;
 static E_Config_DD *conf_item_edd = NULL;
-Mod_Inst *clip_inst = NULL; /* Need by e_mod_config.c */
 static E_Action *act = NULL;
 static Ecore_Timer *delay_sel_timer = NULL;
 
-/*   First some call backs   */
+// first some call backs
 static void       _clipboard_cb_paste_item(void *d1, void *d2);
 static void       _cb_menu_post_deactivate(void *data, E_Menu *menu EINA_UNUSED);
-static void       _cb_context_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Mouse_Event *event);
+static void       _cb_context_show(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Evas_Event_Mouse_Down *event);
 static void       _cb_clear_history(void *d1, void *d2 EINA_UNUSED);
 static void       _cb_dialog_delete(void *data EINA_UNUSED);
 static void       _cb_dialog_keep(void *data EINA_UNUSED);
-static void       _cb_action_switch(E_Object *o EINA_UNUSED, const char *params, Instance *data, Evas *evas, Evas_Object *obj, Mouse_Event *event);
+static void       _cb_action_switch(E_Object *o EINA_UNUSED, const char *params, Instance *data, Evas *evas, Evas_Object *obj, Evas_Event_Mouse_Down *event);
 
 static void       _cb_config_show(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED);
 static void       _clipboard_config_show(void *d1, void *d2 EINA_UNUSED);
 static void       _clipboard_popup_free(Instance *inst);
 
-/*   And then some auxillary functions */
+// and then some auxillary functions
 static void       _clip_config_new(E_Module *m);
 static void       _clip_config_free(void);
 static void       _clip_inst_free(Instance *inst);
@@ -61,28 +60,28 @@ static void       _clear_history(void);
 static Eina_List *_item_in_history(Clip_Data *cd);
 static int        _clip_compare(Clip_Data *cd, char *text);
 
-/* new module needs a new config :), or config too old and we need one anyway */
+// new module needs a new config :), or config too old and we need one anyway
 static void
 _clip_config_new(E_Module *m)
 {
-  /* setup defaults */
+  // setup defaults
   if (!clip_cfg)
     {
       clip_cfg = E_NEW(Config, 1);
 
       clip_cfg->label_length_changed = EINA_FALSE;
 
-      clip_cfg->clip_copy      = CF_DEFAULT_COPY;
-      clip_cfg->clip_select    = CF_DEFAULT_SELECT;
-      clip_cfg->persistence    = CF_DEFAULT_PERSISTANCE;
-      clip_cfg->hist_reverse   = CF_DEFAULT_HIST_REVERSE;
-      clip_cfg->hist_items     = CF_DEFAULT_HIST_ITEMS;
-      clip_cfg->confirm_clear  = CF_DEFAULT_CONFIRM;
-      clip_cfg->label_length   = CF_DEFAULT_LABEL_LENGTH;
-      clip_cfg->ignore_ws      = CF_DEFAULT_IGNORE_WS;
-      clip_cfg->ignore_ws_copy = CF_DEFAULT_IGNORE_WS_COPY;
-      clip_cfg->trim_ws        = CF_DEFAULT_WS;
-      clip_cfg->trim_nl        = CF_DEFAULT_NL;
+      clip_cfg->clip_copy      = 1;
+      clip_cfg->clip_select    = 1;
+      clip_cfg->persistence    = 1;
+      clip_cfg->hist_reverse   = 0;
+      clip_cfg->hist_items     = 20;
+      clip_cfg->confirm_clear  = 1;
+      clip_cfg->label_length   = 50;
+      clip_cfg->ignore_ws      = 0;
+      clip_cfg->ignore_ws_copy = 0;
+      clip_cfg->trim_ws        = 0;
+      clip_cfg->trim_nl        = 0;
     }
   E_CONFIG_LIMIT(clip_cfg->hist_items, HIST_MIN, HIST_MAX);
   E_CONFIG_LIMIT(clip_cfg->label_length, LABEL_MIN, LABEL_MAX);
@@ -96,17 +95,15 @@ _clip_config_new(E_Module *m)
   E_CONFIG_LIMIT(clip_cfg->trim_ws, 0, 1);
   E_CONFIG_LIMIT(clip_cfg->trim_nl, 0, 1);
 
-
-  /* update the version */
+  // update the version
   clip_cfg->version = MOD_CONFIG_FILE_VERSION;
-
   clip_cfg->module = m;
-  /* save the config to disk */
+  // save the config to disk
   e_config_save_queue();
 }
 
-/* This is called when we need to cleanup the actual configuration,
- * for example when our configuration is too old */
+// This is called when we need to cleanup the actual configuration,
+// for example when our configuration is too old
 static void
 _clip_config_free(void)
 {
@@ -224,7 +221,7 @@ static void
 _cb_context_show(void *data,
                  Evas *evas EINA_UNUSED,
                  Evas_Object *obj EINA_UNUSED,
-                 Mouse_Event *event)
+                 Evas_Event_Mouse_Down *event)
 {
   Instance *inst = data;
   Evas_Coord x;
@@ -478,7 +475,7 @@ _cb_action_switch(E_Object *o EINA_UNUSED,
                   Instance *data,
                   Evas *evas EINA_UNUSED,
                   Evas_Object *obj EINA_UNUSED,
-                  Mouse_Event *event EINA_UNUSED)
+                  Evas_Event_Mouse_Down *event EINA_UNUSED)
 {
   if (!strcmp(params, "float")) _clipboard_popup_new(data);
   else if (!strcmp(params, "settings")) _cb_config_show(data, NULL, NULL);
@@ -691,8 +688,8 @@ e_modapi_init(E_Module *m)
     {
       if (eina_list_count(clip_inst->items) > clip_cfg->hist_items)
         {
-          /* FIXME: Do we need to warn user in case this is backed up data
-           *         being restored ? */
+          // FIXME: Do we need to warn user in case this is backed up data
+          // being restored ?
           WRN("History File truncation!");
           truncate_history(clip_cfg->hist_items);
         }
diff --git a/src/modules/clipboard/e_mod_main.h b/src/modules/clipboard/e_mod_main.h
index a7b8f7bc3..87b0a07af 100644
--- a/src/modules/clipboard/e_mod_main.h
+++ b/src/modules/clipboard/e_mod_main.h
@@ -1,21 +1,7 @@
 #ifndef E_MOD_MAIN_H
 #define E_MOD_MAIN_H
 
-#include "common.h"
-
-/* Key Board Bindings action names */
-#define ACT_FLOAT   _("Show History")
-#define ACT_CONFIG  _("Show Settings")
-#define ACT_CLEAR   _("Clear History")
-
-/* Macros used for config file versioning */
-/* You can increment the EPOCH value if the old configuration is not
- * compatible anymore, it creates an entire new one.
- * You need to increment GENERATION when you add new values to the
- * configuration file but is not needed to delete the existing conf  */
-#define MOD_CONFIG_FILE_EPOCH 1
-#define MOD_CONFIG_FILE_GENERATION 4
-#define MOD_CONFIG_FILE_VERSION    ((MOD_CONFIG_FILE_EPOCH * 1000000) + MOD_CONFIG_FILE_GENERATION)
+#include "e.h"
 
 /* Setup the E Module Version, Needed to check if module can run. */
 /* The version is stored at compilation time in the module, and is checked
@@ -36,7 +22,104 @@ EAPI void *e_modapi_init     (E_Module *m);
 EAPI int   e_modapi_shutdown (E_Module *m EINA_UNUSED);
 EAPI int   e_modapi_save     (E_Module *m EINA_UNUSED);
 
-/* Needed elsewhere */
-Eet_Error   clip_save(Eina_List *items);
+/////////////////////////////////////////////////////////////////////////////
+
+// Key Board Bindings action names
+#define ACT_FLOAT   _("Show History")
+#define ACT_CONFIG  _("Show Settings")
+#define ACT_CLEAR   _("Clear History")
+
+// Macros used for config file versioning
+// You can increment the EPOCH value if the old configuration is not
+// compatible anymore, it creates an entire new one.
+// You need to increment GENERATION when you add new values to the
+// configuration file but is not needed to delete the existing conf
+#define MOD_CONFIG_FILE_EPOCH      1
+#define MOD_CONFIG_FILE_GENERATION 4
+#define MOD_CONFIG_FILE_VERSION    ((MOD_CONFIG_FILE_EPOCH * 1000000) + MOD_CONFIG_FILE_GENERATION)
+
+/* Stuff for convenience to compress code */
+#define IF_TRUE_RETURN(exp) \
+   do {                     \
+     if (exp) return;       \
+   } while(0)
+
+typedef struct _Clip_Data Clip_Data;
+typedef struct _Instance Instance;
+typedef struct _Mod_Inst Mod_Inst;
+typedef struct _Config Config;
+typedef struct _Config_Item Config_Item;
+
+struct _Clip_Data
+{ // structure used for storing clipboard data in
+  char *name;
+  char *content;
+};
+
+struct _Instance
+{ // gadget instances
+  E_Gadcon_Client *gcc;
+  Evas_Object *o_button;
+  Evas_Object *table;
+  E_Gadcon_Popup *popup;
+};
+
+struct _Mod_Inst
+{ // sructure to store a global module instance in
+  // complete with a hidden window for event notification purposes
+  Instance *inst;
+  Evas_Object *ewin; // window to send clipboard events to
+  Eina_List *handle; // for handling clipboard events
+  Eina_List *items; // clipboard history
+  Elm_Sel_Type sel_type; // type of sel we last saw change
+};
+
+#define LABEL_MIN  5
+#define LABEL_MAX  100
+
+#define HIST_MIN   5
+#define HIST_MAX   100
+
+/* We create a structure config for our module, and also a config structure
+ * for every item element (you can have multiple gadgets for the same module) */
+struct _Config
+{
+  Eina_List *items;
+  E_Module *module;
+  E_Config_Dialog *config_dialog;
+  const char *log_name;
+  Eina_Bool label_length_changed; // Flag indicating a need to update all clip labels as configfuration changed.
+
+  int version;          /* Configuration version                           */
+  unsigned int hist_items;   /* Number of history items to store                */
+  unsigned int label_length; /* Number of characters of item to display         */
+  // these are booleans really...
+  int clip_copy;        /* Clipboard to use                                */
+  int clip_select;      /* Clipboard to use                                */
+  int persistence;      /* History file persistance                        */
+  int hist_reverse;     /* Order to display History                        */
+  int confirm_clear;    /* Display history confirmation dialog on deletion */
+  int ignore_ws;        /* Should we ignore White space in label           */
+  int ignore_ws_copy;   /* Should we not copy White space only             */
+  int trim_ws;          /* Should we trim White space from selection       */
+  int trim_nl;          /* Should we trim new lines from selection         */
+};
+
+struct _Config_Item
+{
+  const char *id;
+};
+
+extern Config *clip_cfg;
+
+Eet_Error        clip_save(Eina_List *items);
+void             free_clip_data(Clip_Data *clip);
+E_Config_Dialog *config_clipboard_module(Evas_Object *parent, const char *params EINA_UNUSED);
+Eet_Error        truncate_history(const unsigned int n);
+Eet_Error        read_history(Eina_List **items, unsigned int ignore_ws, unsigned int label_length);
+Eet_Error        save_history(Eina_List *items);
+Eina_Bool        set_clip_content(char **content, char *text, int mode);
+Eina_Bool        set_clip_name(char **name, char *text, int mode, int n);
+Eina_Bool        is_empty(const char *str);
 
 #endif
diff --git a/src/modules/clipboard/history.h b/src/modules/clipboard/history.h
deleted file mode 100644
index 92e457400..000000000
--- a/src/modules/clipboard/history.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef CLIPBOARD_HISTORY_H
-#define CLIPBOARD_HISTORY_H
-
-#include "e_mod_main.h"
-
-Eet_Error read_history(Eina_List **items, unsigned int ignore_ws, unsigned int label_length);
-Eet_Error save_history(Eina_List *items);
-
-#endif
diff --git a/src/modules/clipboard/utility.h b/src/modules/clipboard/utility.h
deleted file mode 100644
index 2ab9dacb3..000000000
--- a/src/modules/clipboard/utility.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef CLIPBOARD_UTILITY_H
-#define CLIPBOARD_UTILITY_H
-
-#include "e_mod_main.h"
-
-Eina_Bool set_clip_content(char **content, char *text, int mode);
-Eina_Bool set_clip_name(char **name, char *text, int mode, int n);
-Eina_Bool is_empty(const char *str);
-
-#endif

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to