Commit f091c3fa authored by Sebastian Ramacher's avatar Sebastian Ramacher

rename the headers

parent b81eed38
......@@ -3,11 +3,12 @@
#include <string.h>
#include <stdlib.h>
#include "girara-commands.h"
#include "girara-datastructures.h"
#include "girara-session.h"
#include "girara-internal.h"
#include "girara-utils.h"
#include "commands.h"
#include "datastructures.h"
#include "session.h"
#include "internal.h"
#include "utils.h"
#include "settings.h"
#include "girara.h"
......
......@@ -3,8 +3,8 @@
#ifndef GIRARA_COMMANDS_H
#define GIRARA_COMMANDS_H
#include "girara-types.h"
#include "girara-internal.h"
#include "types.h"
#include "internal.h"
/**
* Default command to map sortcuts
......
......@@ -4,11 +4,11 @@
#include <string.h>
#include <stdlib.h>
#include "girara-completion.h"
#include "girara-internal.h"
#include "girara-session.h"
#include "girara-settings.h"
#include "girara-datastructures.h"
#include "completion.h"
#include "internal.h"
#include "session.h"
#include "settings.h"
#include "datastructures.h"
/* header functions implementation */
static GtkEventBox* girara_completion_row_create(girara_session_t*, char*, char*, bool);
......
......@@ -3,7 +3,7 @@
#ifndef GIRARA_COMPLETION_H
#define GIRARA_COMPLETION_H
#include "girara-types.h"
#include "types.h"
/**
* Structure of a completion element
......
......@@ -3,10 +3,10 @@
#include <stdlib.h>
#include <string.h>
#include "girara-datastructures.h"
#include "girara-session.h"
#include "girara-utils.h"
#include "girara-internal.h"
#include "datastructures.h"
#include "session.h"
#include "utils.h"
#include "internal.h"
#define COMMENT_PREFIX '#'
......
/* See LICENSE file for license and copyright information */
#ifndef GIRARA_CONFIG_H
#define GIRARA_CONFIG_H
#include "types.h"
/**
* Parses and evaluates a configuration file
*
* @param session The used girara session
* @param path Path to the configuration file
*/
void girara_config_parse(girara_session_t* session, const char* path);
/**
* Adds an additional config handler
*
* @param session The girara session
* @param identifier Identifier of the handle
* @param handle Handle
* @return true if no error occured, otherwise false
*/
bool girara_config_handle_add(girara_session_t* session, const char* identifier,
girara_command_function_t handle);
#endif
......@@ -3,7 +3,7 @@
#include <stdlib.h>
#include <glib.h>
#include "girara-datastructures.h"
#include "datastructures.h"
struct girara_tree_node_s
{
......
......@@ -5,7 +5,7 @@
#include <stddef.h>
#include <stdbool.h>
#include "girara-types.h"
#include "types.h"
/**
* Create a new list.
......
......@@ -4,7 +4,7 @@
#include <stdlib.h>
#include "../girara.h"
#include "../girara-internal.h"
#include "../internal.h"
void setting_cb(girara_session_t* session, girara_setting_t* setting);
......
......@@ -6,7 +6,7 @@
#include <math.h>
#include "girara.h"
#include "girara-internal.h"
#include "internal.h"
static void girara_toggle_widget_visibility(GtkWidget* widget);
......@@ -190,95 +190,6 @@ girara_mouse_event_add(girara_session_t* session, guint mask, guint button, gira
return true;
}
girara_statusbar_item_t*
girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill, bool left, girara_statusbar_event_t callback)
{
g_return_val_if_fail(session != NULL && session->elements.statusbar_items, FALSE);
girara_statusbar_item_t* item = g_slice_new(girara_statusbar_item_t);
item->box = gtk_event_box_new();
item->text = GTK_LABEL(gtk_label_new(NULL));
/* set style */
#if (GTK_MAJOR_VERSION == 3)
gtk_widget_override_background_color(GTK_WIDGET(item->box), GTK_STATE_NORMAL, &(session->style.statusbar_background));
gtk_widget_override_color(GTK_WIDGET(item->text), GTK_STATE_NORMAL, &(session->style.statusbar_foreground));
gtk_widget_override_font(GTK_WIDGET(item->text), session->style.font);
#else
gtk_widget_modify_bg(GTK_WIDGET(item->box), GTK_STATE_NORMAL, &(session->style.statusbar_background));
gtk_widget_modify_fg(GTK_WIDGET(item->text), GTK_STATE_NORMAL, &(session->style.statusbar_foreground));
gtk_widget_modify_font(GTK_WIDGET(item->text), session->style.font);
#endif
/* set properties */
gtk_misc_set_alignment(GTK_MISC(item->text), left ? 0.0 : 1.0, 0.0);
gtk_misc_set_padding(GTK_MISC(item->text), 2, 4);
gtk_label_set_use_markup(item->text, TRUE);
if (callback) {
g_signal_connect(G_OBJECT(item->box), "button-press-event", G_CALLBACK(callback), session);
}
/* add it to the list */
gtk_container_add(GTK_CONTAINER(item->box), GTK_WIDGET(item->text));
gtk_box_pack_start(session->gtk.statusbar_entries, GTK_WIDGET(item->box), expand, fill, 2);
gtk_widget_show_all(GTK_WIDGET(item->box));
girara_list_prepend(session->elements.statusbar_items, item);
return item;
}
void
girara_statusbar_item_free(girara_statusbar_item_t* item)
{
g_slice_free(girara_statusbar_item_t, item);
}
bool
girara_statusbar_item_set_text(girara_session_t* session, girara_statusbar_item_t* item, char* text)
{
g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(item != NULL, FALSE);
char* escaped_text = g_markup_escape_text(text, -1);
gtk_label_set_markup((GtkLabel*) item->text, escaped_text);
g_free(escaped_text);
return TRUE;
}
bool
girara_statusbar_item_set_foreground(girara_session_t* session, girara_statusbar_item_t* item, char* color)
{
g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(item != NULL, FALSE);
GdkColor gdk_color;
gdk_color_parse(color, &gdk_color);
gtk_widget_modify_fg(GTK_WIDGET(item->text), GTK_STATE_NORMAL, &gdk_color);
return TRUE;
}
bool
girara_statusbar_set_background(girara_session_t* session, char* color)
{
g_return_val_if_fail(session != NULL, FALSE);
#if (GTK_MAJOR_VERSION == 3)
GdkRGBA gdk_color;
gdk_rgba_parse(&gdk_color, color);
gtk_widget_override_background_color(GTK_WIDGET(session->gtk.statusbar), GTK_STATE_NORMAL, &gdk_color);
#else
GdkColor gdk_color;
gdk_color_parse(color, &gdk_color);
gtk_widget_modify_bg(GTK_WIDGET(session->gtk.statusbar), GTK_STATE_NORMAL, &gdk_color);
#endif
return TRUE;
}
bool
girara_isc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument), unsigned int UNUSED(t))
{
......
......@@ -3,19 +3,8 @@
#ifndef GIRARA_H
#define GIRARA_H
#include "girara-types.h"
#include "girara-session.h"
/**
* Function declaration for a statusbar event callback
*
* @param widget The statusbar item
* @param event The occured event
* @param session The current girara session
* @return TRUE No error occured
* @return FALSE Error occured (and forward event)
*/
typedef bool (*girara_statusbar_event_t)(GtkWidget* widget, GdkEvent* event, girara_session_t* session);
#include "types.h"
#include "session.h"
/**
* Adds an shortcut
......@@ -91,51 +80,6 @@ bool girara_special_command_add(girara_session_t* session, char identifier, gira
*/
bool girara_mouse_event_add(girara_session_t* session, guint mask, guint button, girara_shortcut_function_t function, girara_mode_t mode, int argument_n, void* argument_data);
/**
* Creates an statusbar item
*
* @param session The used girara session
* @param expand Expand attribute
* @param fill Fill attribute
* @param left True if it should be aligned to the left
* @param callback Function that gets executed when an event occurs
* @return The created statusbar item
* @return NULL An error occured
*/
girara_statusbar_item_t* girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill, bool left, girara_statusbar_event_t callback);
/**
* Sets the shown text of an statusbar item
*
* @param session The used girara session
* @param item The statusbar item
* @param text Text that should be displayed
* @return TRUE No error occured
* @return FALSE An error occured
*/
bool girara_statusbar_item_set_text(girara_session_t* session, girara_statusbar_item_t* item, char* text);
/**
* Sets the foreground color of an statusbar item
*
* @param session The used girara session
* @param item The statusbar item
* @param color The color code
* @return TRUE No error occured
* @return FALSE An error occured
*/
bool girara_statusbar_item_set_foreground(girara_session_t* session, girara_statusbar_item_t* item, char* color);
/**
* Sets the background color of the statusbar
*
* @param session The used girara session
* @param color The color code
* @return TRUE No error occured
* @return FALSE An error occured
*/
bool girara_statusbar_set_background(girara_session_t* session, char* color);
/**
* Default shortcut function to focus the inputbar
*
......@@ -315,25 +259,6 @@ void girara_mode_set(girara_session_t* session, girara_mode_t mode);
*/
girara_mode_t girara_mode_get(girara_session_t* session);
/**
* Parses and evaluates a configuration file
*
* @param session The used girara session
* @param path Path to the configuration file
*/
void girara_config_parse(girara_session_t* session, const char* path);
/**
* Adds an additional config handler
*
* @param session The girara session
* @param identifier Identifier of the handle
* @param handle Handle
* @return true if no error occured, otherwise false
*/
bool girara_config_handle_add(girara_session_t* session, const char* identifier,
girara_command_function_t handle);
/**
* Creates a mapping between a shortcut function and an identifier and is used
* to evaluate the mapping command
......@@ -358,10 +283,12 @@ bool girara_shortcut_mapping_add(girara_session_t* session, char* identifier,
bool girara_argument_mapping_add(girara_session_t* session, char* identifier,
int value);
#include "girara-utils.h"
#include "girara-datastructures.h"
#include "girara-settings.h"
#include "girara-completion.h"
#include "girara-tabs.h"
#include "utils.h"
#include "datastructures.h"
#include "settings.h"
#include "completion.h"
#include "tabs.h"
#include "config.h"
#include "statusbar.h"
#endif
......@@ -3,7 +3,7 @@
#ifndef GIRARA_INTERNAL_H
#define GIRARA_INTERNAL_H
#include "girara-types.h"
#include "types.h"
#include <gtk/gtk.h>
#define CLEAN(m) (m & ~(GDK_MOD2_MASK) & ~(GDK_MOD5_MASK) & ~(GDK_BUTTON1_MASK) & ~(GDK_BUTTON2_MASK) & ~(GDK_BUTTON3_MASK) & ~(GDK_BUTTON4_MASK) & ~(GDK_BUTTON5_MASK) & ~(GDK_LEAVE_NOTIFY_MASK))
......@@ -27,7 +27,6 @@
#endif
#define LENGTH(x) (sizeof(x)/sizeof((x)[0]))
#define UNTITLED_TAB_TITLE "untitled"
/**
* Free girara_settings_t struct
......@@ -77,15 +76,6 @@ struct girara_command_s
char* description; /**< Description of the command */
};
/**
* Structure of a statusbar item
*/
struct girara_statusbar_item_s
{
GtkWidget* box; /**< Event box */
GtkLabel *text; /**< Text label */
};
struct girara_mode_string_s
{
girara_mode_t index; /**< Index */
......
......@@ -2,11 +2,11 @@
#include <stdlib.h>
#include "girara-session.h"
#include "girara-settings.h"
#include "girara-datastructures.h"
#include "girara-internal.h"
#include "girara-commands.h"
#include "session.h"
#include "settings.h"
#include "datastructures.h"
#include "internal.h"
#include "commands.h"
#include "girara.h"
......
......@@ -3,7 +3,7 @@
#ifndef GIRARA_SESSION_H
#define GIRARA_SESSION_H
#include "girara-types.h"
#include "types.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
......
......@@ -4,11 +4,11 @@
#include <glib.h>
#include <string.h>
#include "girara-settings.h"
#include "girara-internal.h"
#include "girara-datastructures.h"
#include "girara-completion.h"
#include "girara-session.h"
#include "settings.h"
#include "internal.h"
#include "datastructures.h"
#include "completion.h"
#include "session.h"
static void
set_value(girara_setting_t* setting, void* value)
......
......@@ -3,7 +3,7 @@
#ifndef GIRARA_SETTINGS_H
#define GIRARA_SETTINGS_H
#include "girara-types.h"
#include "types.h"
/**
* Adds an additional entry in the settings list
......
/* See LICENSE file for license and copyright information */
#include "statusbar.h"
#include "session.h"
#include "datastructures.h"
/**
* Structure of a statusbar item
*/
struct girara_statusbar_item_s
{
GtkWidget* box; /**< Event box */
GtkLabel *text; /**< Text label */
};
girara_statusbar_item_t*
girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill, bool left, girara_statusbar_event_t callback)
{
g_return_val_if_fail(session != NULL && session->elements.statusbar_items, FALSE);
girara_statusbar_item_t* item = g_slice_new(girara_statusbar_item_t);
item->box = gtk_event_box_new();
item->text = GTK_LABEL(gtk_label_new(NULL));
/* set style */
#if (GTK_MAJOR_VERSION == 3)
gtk_widget_override_background_color(GTK_WIDGET(item->box), GTK_STATE_NORMAL, &(session->style.statusbar_background));
gtk_widget_override_color(GTK_WIDGET(item->text), GTK_STATE_NORMAL, &(session->style.statusbar_foreground));
gtk_widget_override_font(GTK_WIDGET(item->text), session->style.font);
#else
gtk_widget_modify_bg(GTK_WIDGET(item->box), GTK_STATE_NORMAL, &(session->style.statusbar_background));
gtk_widget_modify_fg(GTK_WIDGET(item->text), GTK_STATE_NORMAL, &(session->style.statusbar_foreground));
gtk_widget_modify_font(GTK_WIDGET(item->text), session->style.font);
#endif
/* set properties */
gtk_misc_set_alignment(GTK_MISC(item->text), left ? 0.0 : 1.0, 0.0);
gtk_misc_set_padding(GTK_MISC(item->text), 2, 4);
gtk_label_set_use_markup(item->text, TRUE);
if (callback) {
g_signal_connect(G_OBJECT(item->box), "button-press-event", G_CALLBACK(callback), session);
}
/* add it to the list */
gtk_container_add(GTK_CONTAINER(item->box), GTK_WIDGET(item->text));
gtk_box_pack_start(session->gtk.statusbar_entries, GTK_WIDGET(item->box), expand, fill, 2);
gtk_widget_show_all(GTK_WIDGET(item->box));
girara_list_prepend(session->elements.statusbar_items, item);
return item;
}
void
girara_statusbar_item_free(girara_statusbar_item_t* item)
{
g_slice_free(girara_statusbar_item_t, item);
}
bool
girara_statusbar_item_set_text(girara_session_t* session, girara_statusbar_item_t* item, char* text)
{
g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(item != NULL, FALSE);
char* escaped_text = g_markup_escape_text(text, -1);
gtk_label_set_markup((GtkLabel*) item->text, escaped_text);
g_free(escaped_text);
return TRUE;
}
bool
girara_statusbar_item_set_foreground(girara_session_t* session, girara_statusbar_item_t* item, char* color)
{
g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(item != NULL, FALSE);
GdkColor gdk_color;
gdk_color_parse(color, &gdk_color);
gtk_widget_modify_fg(GTK_WIDGET(item->text), GTK_STATE_NORMAL, &gdk_color);
return TRUE;
}
bool
girara_statusbar_set_background(girara_session_t* session, char* color)
{
g_return_val_if_fail(session != NULL, FALSE);
#if (GTK_MAJOR_VERSION == 3)
GdkRGBA gdk_color;
gdk_rgba_parse(&gdk_color, color);
gtk_widget_override_background_color(GTK_WIDGET(session->gtk.statusbar), GTK_STATE_NORMAL, &gdk_color);
#else
GdkColor gdk_color;
gdk_color_parse(color, &gdk_color);
gtk_widget_modify_bg(GTK_WIDGET(session->gtk.statusbar), GTK_STATE_NORMAL, &gdk_color);
#endif
return TRUE;
}
/* See LICENSE file for license and copyright information */
#ifndef GIRARA_STATUSBAR_H
#define GIRARA_STATUSBAR_H
#include "types.h"
#include <gtk/gtk.h>
/**
* Function declaration for a statusbar event callback
*
* @param widget The statusbar item
* @param event The occured event
* @param session The current girara session
* @return TRUE No error occured
* @return FALSE Error occured (and forward event)
*/
typedef bool (*girara_statusbar_event_t)(GtkWidget* widget, GdkEvent* event, girara_session_t* session);
/**
* Creates an statusbar item
*
* @param session The used girara session
* @param expand Expand attribute
* @param fill Fill attribute
* @param left True if it should be aligned to the left
* @param callback Function that gets executed when an event occurs
* @return The created statusbar item
* @return NULL An error occured
*/
girara_statusbar_item_t* girara_statusbar_item_add(girara_session_t* session, bool expand, bool fill, bool left, girara_statusbar_event_t callback);
/**
* Sets the shown text of an statusbar item
*
* @param session The used girara session
* @param item The statusbar item
* @param text Text that should be displayed
* @return TRUE No error occured
* @return FALSE An error occured
*/
bool girara_statusbar_item_set_text(girara_session_t* session, girara_statusbar_item_t* item, char* text);
/**
* Sets the foreground color of an statusbar item
*
* @param session The used girara session
* @param item The statusbar item
* @param color The color code
* @return TRUE No error occured
* @return FALSE An error occured
*/
bool girara_statusbar_item_set_foreground(girara_session_t* session, girara_statusbar_item_t* item, char* color);
/**
* Sets the background color of the statusbar
*
* @param session The used girara session
* @param color The color code
* @return TRUE No error occured
* @return FALSE An error occured
*/
bool girara_statusbar_set_background(girara_session_t* session, char* color);
#endif
/* See LICENSE file for license and copyright information */
#include "girara-tabs.h"
#include "girara-session.h"
// #include "girara.h"
#include "girara-internal.h"
#include "tabs.h"
#include "session.h"
#include "internal.h"
#define UNTITLED_TAB_TITLE "untitled"
/**
* Default implementation of the event that is executed if a tab is clicked
......@@ -15,7 +16,6 @@
*/
static bool girara_callback_tab_clicked(GtkWidget* widget, GdkEventButton* event, gpointer data);
void
girara_tabs_enable(girara_session_t* session)
{
......
......@@ -3,7 +3,7 @@
#ifndef GIRARA_TABS_H
#define GIRARA_TABS_H
#include "girara-types.h"
#include "types.h"
#include <gtk/gtk.h>
/**
......
......@@ -13,7 +13,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "girara-utils.h"
#include "utils.h"
#define BLOCK_SIZE 64
......
......@@ -5,7 +5,7 @@
#include <glib.h>
#include <stdio.h>
#include "girara-types.h"
#include "types.h"
/**
* Enum for directories specified in the XDG specification.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment