Compare commits
No commits in common. "093baaa0342b8e10ea5358e2202c6df6423810a9" and "e383a50af724b229115abb927521b4480cf41265" have entirely different histories.
093baaa034
...
e383a50af7
15
src/sdgui.c
15
src/sdgui.c
@ -39,7 +39,6 @@ static struct
|
|||||||
GtkWidget *view; ///< Entries view
|
GtkWidget *view; ///< Entries view
|
||||||
|
|
||||||
gint dictionary; ///< Index of the current dictionary
|
gint dictionary; ///< Index of the current dictionary
|
||||||
gint last; ///< The last dictionary index
|
|
||||||
GPtrArray *dictionaries; ///< All open dictionaries
|
GPtrArray *dictionaries; ///< All open dictionaries
|
||||||
|
|
||||||
gboolean watch_selection; ///< Following X11 PRIMARY?
|
gboolean watch_selection; ///< Following X11 PRIMARY?
|
||||||
@ -161,7 +160,6 @@ static void
|
|||||||
on_switch_page (G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED GtkWidget *page,
|
on_switch_page (G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED GtkWidget *page,
|
||||||
guint page_num, G_GNUC_UNUSED gpointer data)
|
guint page_num, G_GNUC_UNUSED gpointer data)
|
||||||
{
|
{
|
||||||
g.last = g.dictionary;
|
|
||||||
g.dictionary = page_num;
|
g.dictionary = page_num;
|
||||||
search (g_ptr_array_index (g.dictionaries, g.dictionary));
|
search (g_ptr_array_index (g.dictionaries, g.dictionary));
|
||||||
}
|
}
|
||||||
@ -219,11 +217,6 @@ on_key_press (G_GNUC_UNUSED GtkWidget *widget, GdkEvent *event,
|
|||||||
gtk_notebook_set_current_page (notebook, (n ? n : 10) - 1);
|
gtk_notebook_set_current_page (notebook, (n ? n : 10) - 1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (event->key.keyval == GDK_KEY_Tab)
|
|
||||||
{
|
|
||||||
gtk_notebook_set_current_page (notebook, g.last);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mods == 0)
|
if (mods == 0)
|
||||||
{
|
{
|
||||||
@ -243,12 +236,12 @@ on_key_press (G_GNUC_UNUSED GtkWidget *widget, GdkEvent *event,
|
|||||||
static void
|
static void
|
||||||
init_tabs (void)
|
init_tabs (void)
|
||||||
{
|
{
|
||||||
for (gsize i = g.dictionaries->len; i--; )
|
for (gsize i = 0; i < g.dictionaries->len; i++)
|
||||||
{
|
{
|
||||||
Dictionary *dict = g_ptr_array_index (g.dictionaries, i);
|
Dictionary *dict = g_ptr_array_index (g.dictionaries, i);
|
||||||
GtkWidget *dummy = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
GtkWidget *dummy = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
GtkWidget *label = gtk_label_new (dict->name);
|
GtkWidget *label = gtk_label_new (dict->name);
|
||||||
gtk_notebook_insert_page (GTK_NOTEBOOK (g.notebook), dummy, label, 0);
|
gtk_notebook_append_page (GTK_NOTEBOOK (g.notebook), dummy, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_show_all (g.notebook);
|
gtk_widget_show_all (g.notebook);
|
||||||
@ -455,9 +448,9 @@ main (int argc, char *argv[])
|
|||||||
GtkWidget *menu = gtk_menu_new ();
|
GtkWidget *menu = gtk_menu_new ();
|
||||||
gtk_widget_set_halign (menu, GTK_ALIGN_END);
|
gtk_widget_set_halign (menu, GTK_ALIGN_END);
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_open);
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_open);
|
||||||
#ifndef G_OS_WIN32
|
#ifndef WIN32
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_selection);
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_selection);
|
||||||
#endif // ! G_OS_WIN32
|
#endif // ! WIN32
|
||||||
gtk_widget_show_all (menu);
|
gtk_widget_show_all (menu);
|
||||||
|
|
||||||
g.hamburger = gtk_menu_button_new ();
|
g.hamburger = gtk_menu_button_new ();
|
||||||
|
25
src/sdtui.c
25
src/sdtui.c
@ -154,7 +154,6 @@ struct application
|
|||||||
GPtrArray * dictionaries; ///< All loaded AppDictionaries
|
GPtrArray * dictionaries; ///< All loaded AppDictionaries
|
||||||
|
|
||||||
StardictDict * dict; ///< The current dictionary
|
StardictDict * dict; ///< The current dictionary
|
||||||
StardictDict * last; ///< The last dictionary
|
|
||||||
guint show_help : 1; ///< Whether help can be shown
|
guint show_help : 1; ///< Whether help can be shown
|
||||||
guint center_search : 1; ///< Whether to center the search
|
guint center_search : 1; ///< Whether to center the search
|
||||||
guint underline_last : 1; ///< Underline the last definition
|
guint underline_last : 1; ///< Underline the last definition
|
||||||
@ -1331,18 +1330,6 @@ app_get_current_definition (Application *self)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
app_goto_dictionary_directly (Application *self, StardictDict *dict)
|
|
||||||
{
|
|
||||||
if (dict == self->dict)
|
|
||||||
return;
|
|
||||||
|
|
||||||
self->last = self->dict;
|
|
||||||
self->dict = dict;
|
|
||||||
app_search_for_entry (self);
|
|
||||||
app_redraw_top (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Switch to a different dictionary by number.
|
/// Switch to a different dictionary by number.
|
||||||
static gboolean
|
static gboolean
|
||||||
app_goto_dictionary (Application *self, guint n)
|
app_goto_dictionary (Application *self, guint n)
|
||||||
@ -1351,7 +1338,9 @@ app_goto_dictionary (Application *self, guint n)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Dictionary *dict = g_ptr_array_index (self->dictionaries, n);
|
Dictionary *dict = g_ptr_array_index (self->dictionaries, n);
|
||||||
app_goto_dictionary_directly (self, dict->dict);
|
self->dict = dict->dict;
|
||||||
|
app_search_for_entry (self);
|
||||||
|
app_redraw_top (self);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1414,7 +1403,6 @@ enum user_action
|
|||||||
USER_ACTION_GOTO_PAGE_NEXT,
|
USER_ACTION_GOTO_PAGE_NEXT,
|
||||||
USER_ACTION_GOTO_DICTIONARY_PREVIOUS,
|
USER_ACTION_GOTO_DICTIONARY_PREVIOUS,
|
||||||
USER_ACTION_GOTO_DICTIONARY_NEXT,
|
USER_ACTION_GOTO_DICTIONARY_NEXT,
|
||||||
USER_ACTION_GOTO_DICTIONARY_LAST,
|
|
||||||
|
|
||||||
USER_ACTION_FLIP,
|
USER_ACTION_FLIP,
|
||||||
|
|
||||||
@ -1517,12 +1505,6 @@ app_process_user_action (Application *self, UserAction action)
|
|||||||
if (!app_goto_dictionary_delta (self, +1))
|
if (!app_goto_dictionary_delta (self, +1))
|
||||||
beep ();
|
beep ();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case USER_ACTION_GOTO_DICTIONARY_LAST:
|
|
||||||
if (!self->last)
|
|
||||||
beep ();
|
|
||||||
else
|
|
||||||
app_goto_dictionary_directly (self, self->last);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
@ -1696,7 +1678,6 @@ app_process_keysym (Application *self, termo_key_t *event)
|
|||||||
{
|
{
|
||||||
[TERMO_SYM_LEFT] = USER_ACTION_MOVE_SPLITTER_LEFT,
|
[TERMO_SYM_LEFT] = USER_ACTION_MOVE_SPLITTER_LEFT,
|
||||||
[TERMO_SYM_RIGHT] = USER_ACTION_MOVE_SPLITTER_RIGHT,
|
[TERMO_SYM_RIGHT] = USER_ACTION_MOVE_SPLITTER_RIGHT,
|
||||||
[TERMO_SYM_TAB] = USER_ACTION_GOTO_DICTIONARY_LAST,
|
|
||||||
};
|
};
|
||||||
static ActionMap actions_ctrl =
|
static ActionMap actions_ctrl =
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user