rm useless glib typedef usage
This commit is contained in:
parent
f075a89078
commit
54172d53bf
34
termite.c
34
termite.c
|
@ -26,7 +26,7 @@ typedef struct search_panel_info {
|
||||||
enum overlay_mode mode;
|
enum overlay_mode mode;
|
||||||
} search_panel_info;
|
} search_panel_info;
|
||||||
|
|
||||||
static gchar *browser_cmd[3] = {NULL};
|
static char *browser_cmd[3] = {NULL};
|
||||||
|
|
||||||
static void launch_browser(char *url);
|
static void launch_browser(char *url);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ static void get_vte_padding(VteTerminal *vte, int *w, int *h);
|
||||||
static char *check_match(VteTerminal *vte, int event_x, int event_y);
|
static char *check_match(VteTerminal *vte, int event_x, int event_y);
|
||||||
static void load_config(GtkWindow *window, VteTerminal *vte,
|
static void load_config(GtkWindow *window, VteTerminal *vte,
|
||||||
gboolean *dynamic_title, gboolean *urgent_on_bell,
|
gboolean *dynamic_title, gboolean *urgent_on_bell,
|
||||||
gboolean *clickable_url, const gchar **term);
|
gboolean *clickable_url, const char **term);
|
||||||
|
|
||||||
void launch_browser(char *url) {
|
void launch_browser(char *url) {
|
||||||
browser_cmd[1] = url;
|
browser_cmd[1] = url;
|
||||||
|
@ -109,7 +109,7 @@ gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, search_panel_in
|
||||||
if (event->keyval == GDK_KEY_Escape) {
|
if (event->keyval == GDK_KEY_Escape) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
} else if (event->keyval == GDK_KEY_Return) {
|
} else if (event->keyval == GDK_KEY_Return) {
|
||||||
const gchar *text = gtk_entry_get_text(entry);
|
const char *text = gtk_entry_get_text(entry);
|
||||||
|
|
||||||
switch (info->mode) {
|
switch (info->mode) {
|
||||||
case OVERLAY_SEARCH:
|
case OVERLAY_SEARCH:
|
||||||
|
@ -184,9 +184,9 @@ gboolean add_to_list_store(char *key,
|
||||||
GtkTreeModel *create_completion_model(VteTerminal *vte) {
|
GtkTreeModel *create_completion_model(VteTerminal *vte) {
|
||||||
GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING);
|
GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING);
|
||||||
|
|
||||||
glong end_row, end_col;
|
long end_row, end_col;
|
||||||
vte_terminal_get_cursor_position(vte, &end_col, &end_row);
|
vte_terminal_get_cursor_position(vte, &end_col, &end_row);
|
||||||
gchar *content = vte_terminal_get_text_range(vte, 0, 0, end_row, end_col,
|
char *content = vte_terminal_get_text_range(vte, 0, 0, end_row, end_col,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
|
@ -282,17 +282,17 @@ static bool get_config_ ## NAME (GKeyFile *config, const char *group, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
MAKE_GET_CONFIG_FUNCTION(boolean, gboolean)
|
MAKE_GET_CONFIG_FUNCTION(boolean, gboolean)
|
||||||
MAKE_GET_CONFIG_FUNCTION(integer, gint)
|
MAKE_GET_CONFIG_FUNCTION(integer, int)
|
||||||
MAKE_GET_CONFIG_FUNCTION(string, gchar *)
|
MAKE_GET_CONFIG_FUNCTION(string, char *)
|
||||||
MAKE_GET_CONFIG_FUNCTION(double, gdouble)
|
MAKE_GET_CONFIG_FUNCTION(double, double)
|
||||||
|
|
||||||
static void load_config(GtkWindow *window, VteTerminal *vte,
|
static void load_config(GtkWindow *window, VteTerminal *vte,
|
||||||
gboolean *dynamic_title, gboolean *urgent_on_bell,
|
gboolean *dynamic_title, gboolean *urgent_on_bell,
|
||||||
gboolean *clickable_url, const gchar **term) {
|
gboolean *clickable_url, const char **term) {
|
||||||
|
|
||||||
static const char *filename = "termite.cfg";
|
static const char *filename = "termite.cfg";
|
||||||
const gchar *dir = g_get_user_config_dir();
|
const char *dir = g_get_user_config_dir();
|
||||||
gchar *path = g_build_filename(dir, filename, NULL);
|
char *path = g_build_filename(dir, filename, NULL);
|
||||||
|
|
||||||
GKeyFile *config = g_key_file_new();
|
GKeyFile *config = g_key_file_new();
|
||||||
|
|
||||||
|
@ -300,9 +300,9 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
|
||||||
g_key_file_load_from_dirs(config, filename, (const char **)g_get_system_config_dirs(),
|
g_key_file_load_from_dirs(config, filename, (const char **)g_get_system_config_dirs(),
|
||||||
NULL, G_KEY_FILE_NONE, NULL))) {
|
NULL, G_KEY_FILE_NONE, NULL))) {
|
||||||
gboolean cfgbool;
|
gboolean cfgbool;
|
||||||
gdouble cfgdouble;
|
double cfgdouble;
|
||||||
gint cfgint;
|
int cfgint;
|
||||||
gchar *cfgstr;
|
char *cfgstr;
|
||||||
|
|
||||||
if (term && get_config_string(config, "options", "term", &cfgstr)) {
|
if (term && get_config_string(config, "options", "term", &cfgstr)) {
|
||||||
*term = cfgstr;
|
*term = cfgstr;
|
||||||
|
@ -396,7 +396,7 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
|
||||||
for (unsigned i = 0; i < 8; i++) {
|
for (unsigned i = 0; i < 8; i++) {
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gsize length;
|
gsize length;
|
||||||
gchar **pair = g_key_file_get_string_list(config, "colors", colors[i], &length, &error);
|
char **pair = g_key_file_get_string_list(config, "colors", colors[i], &length, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
success = false;
|
success = false;
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
|
@ -482,8 +482,8 @@ int main(int argc, char **argv) {
|
||||||
char *default_argv[2] = {fallback, NULL};
|
char *default_argv[2] = {fallback, NULL};
|
||||||
|
|
||||||
if (execute) {
|
if (execute) {
|
||||||
gint argcp;
|
int argcp;
|
||||||
gchar **argvp;
|
char **argvp;
|
||||||
g_shell_parse_argv(execute, &argcp, &argvp, &error);
|
g_shell_parse_argv(execute, &argcp, &argvp, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
g_printerr("Failed to parse command: %s\n", error->message);
|
g_printerr("Failed to parse command: %s\n", error->message);
|
||||||
|
|
Loading…
Reference in New Issue