forked from AuroraMiddleware/gtk
Switch over to GtkTreeView from GtkCList. Remove the entries above the
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from GtkCList. Remove the entries above the font/face lists since they were a little confusing. (Not sure about this change, so the code is still there the entries are just hidden.) (#68890) * gtk/gtkfilesel.c: Switch over to GtkTreeView from GtkCList. Add mnemonics for fileops. Allow Control/Shift Tab to focus out. * gtk/gtkfilesel.c: Make fileop dialogs transient-for the fileselector. (#69336, patch from Melvin Hadasht) * gtk/gtkgamma.c (button_clicked_callback): Fix handling of gamma dialog a bit. (#69336, Matthias Clasen.)
This commit is contained in:
parent
53ca71377d
commit
833b99fca2
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
|||||||
|
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Remove the entries above the font/face lists
|
||||||
|
since they were a little confusing. (Not sure about this
|
||||||
|
change, so the code is still there the entries are
|
||||||
|
just hidden.) (#68890)
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Add mnemonics for fileops. Allow Control/Shift
|
||||||
|
Tab to focus out.
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Make fileop dialogs transient-for
|
||||||
|
the fileselector. (#69336, patch from Melvin Hadasht)
|
||||||
|
|
||||||
|
* gtk/gtkgamma.c (button_clicked_callback): Fix handling
|
||||||
|
of gamma dialog a bit. (#69336, Matthias Clasen.)
|
||||||
|
|
||||||
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Remove the entries above the font/face lists
|
||||||
|
since they were a little confusing. (Not sure about this
|
||||||
|
change, so the code is still there the entries are
|
||||||
|
just hidden.) (#68890)
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Add mnemonics for fileops. Allow Control/Shift
|
||||||
|
Tab to focus out.
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Make fileop dialogs transient-for
|
||||||
|
the fileselector. (#69336, patch from Melvin Hadasht)
|
||||||
|
|
||||||
|
* gtk/gtkgamma.c (button_clicked_callback): Fix handling
|
||||||
|
of gamma dialog a bit. (#69336, Matthias Clasen.)
|
||||||
|
|
||||||
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Remove the entries above the font/face lists
|
||||||
|
since they were a little confusing. (Not sure about this
|
||||||
|
change, so the code is still there the entries are
|
||||||
|
just hidden.) (#68890)
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Add mnemonics for fileops. Allow Control/Shift
|
||||||
|
Tab to focus out.
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Make fileop dialogs transient-for
|
||||||
|
the fileselector. (#69336, patch from Melvin Hadasht)
|
||||||
|
|
||||||
|
* gtk/gtkgamma.c (button_clicked_callback): Fix handling
|
||||||
|
of gamma dialog a bit. (#69336, Matthias Clasen.)
|
||||||
|
|
||||||
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Remove the entries above the font/face lists
|
||||||
|
since they were a little confusing. (Not sure about this
|
||||||
|
change, so the code is still there the entries are
|
||||||
|
just hidden.) (#68890)
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Add mnemonics for fileops. Allow Control/Shift
|
||||||
|
Tab to focus out.
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Make fileop dialogs transient-for
|
||||||
|
the fileselector. (#69336, patch from Melvin Hadasht)
|
||||||
|
|
||||||
|
* gtk/gtkgamma.c (button_clicked_callback): Fix handling
|
||||||
|
of gamma dialog a bit. (#69336, Matthias Clasen.)
|
||||||
|
|
||||||
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Remove the entries above the font/face lists
|
||||||
|
since they were a little confusing. (Not sure about this
|
||||||
|
change, so the code is still there the entries are
|
||||||
|
just hidden.) (#68890)
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Add mnemonics for fileops. Allow Control/Shift
|
||||||
|
Tab to focus out.
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Make fileop dialogs transient-for
|
||||||
|
the fileselector. (#69336, patch from Melvin Hadasht)
|
||||||
|
|
||||||
|
* gtk/gtkgamma.c (button_clicked_callback): Fix handling
|
||||||
|
of gamma dialog a bit. (#69336, Matthias Clasen.)
|
||||||
|
|
||||||
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Remove the entries above the font/face lists
|
||||||
|
since they were a little confusing. (Not sure about this
|
||||||
|
change, so the code is still there the entries are
|
||||||
|
just hidden.) (#68890)
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Add mnemonics for fileops. Allow Control/Shift
|
||||||
|
Tab to focus out.
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Make fileop dialogs transient-for
|
||||||
|
the fileselector. (#69336, patch from Melvin Hadasht)
|
||||||
|
|
||||||
|
* gtk/gtkgamma.c (button_clicked_callback): Fix handling
|
||||||
|
of gamma dialog a bit. (#69336, Matthias Clasen.)
|
||||||
|
|
||||||
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
Tue Jan 29 15:24:59 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtkfontsel.[ch]: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Remove the entries above the font/face lists
|
||||||
|
since they were a little confusing. (Not sure about this
|
||||||
|
change, so the code is still there the entries are
|
||||||
|
just hidden.) (#68890)
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Switch over to GtkTreeView from
|
||||||
|
GtkCList. Add mnemonics for fileops. Allow Control/Shift
|
||||||
|
Tab to focus out.
|
||||||
|
|
||||||
|
* gtk/gtkfilesel.c: Make fileop dialogs transient-for
|
||||||
|
the fileselector. (#69336, patch from Melvin Hadasht)
|
||||||
|
|
||||||
|
* gtk/gtkgamma.c (button_clicked_callback): Fix handling
|
||||||
|
of gamma dialog a bit. (#69336, Matthias Clasen.)
|
||||||
|
|
||||||
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Jan 29 14:56:28 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
* gtk/gtksocket.c (toplevel_focus_out_handler): Return boolean
|
||||||
|
258
gtk/gtkfilesel.c
258
gtk/gtkfilesel.c
@ -49,22 +49,23 @@
|
|||||||
|
|
||||||
#include "gdk/gdkkeysyms.h"
|
#include "gdk/gdkkeysyms.h"
|
||||||
#include "gtkbutton.h"
|
#include "gtkbutton.h"
|
||||||
|
#include "gtkcellrenderertext.h"
|
||||||
#include "gtkentry.h"
|
#include "gtkentry.h"
|
||||||
#include "gtkfilesel.h"
|
#include "gtkfilesel.h"
|
||||||
#include "gtkhbox.h"
|
#include "gtkhbox.h"
|
||||||
#include "gtkhbbox.h"
|
#include "gtkhbbox.h"
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
#include "gtklist.h"
|
#include "gtkliststore.h"
|
||||||
#include "gtklistitem.h"
|
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkscrolledwindow.h"
|
#include "gtkscrolledwindow.h"
|
||||||
#include "gtkstock.h"
|
#include "gtkstock.h"
|
||||||
#include "gtksignal.h"
|
#include "gtksignal.h"
|
||||||
|
#include "gtktreeselection.h"
|
||||||
|
#include "gtktreeview.h"
|
||||||
#include "gtkvbox.h"
|
#include "gtkvbox.h"
|
||||||
#include "gtkmenu.h"
|
#include "gtkmenu.h"
|
||||||
#include "gtkmenuitem.h"
|
#include "gtkmenuitem.h"
|
||||||
#include "gtkoptionmenu.h"
|
#include "gtkoptionmenu.h"
|
||||||
#include "gtkclist.h"
|
|
||||||
#include "gtkdialog.h"
|
#include "gtkdialog.h"
|
||||||
#include "gtkmessagedialog.h"
|
#include "gtkmessagedialog.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
@ -233,6 +234,14 @@ enum {
|
|||||||
PROP_FILENAME
|
PROP_FILENAME
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DIR_COLUMN
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FILE_COLUMN
|
||||||
|
};
|
||||||
|
|
||||||
/* File completion functions which would be external, were they used
|
/* File completion functions which would be external, were they used
|
||||||
* outside of this file.
|
* outside of this file.
|
||||||
*/
|
*/
|
||||||
@ -367,17 +376,16 @@ static gint gtk_file_selection_insert_text (GtkWidget *widget,
|
|||||||
gint *position,
|
gint *position,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
static void gtk_file_selection_file_button (GtkWidget *widget,
|
static void gtk_file_selection_file_activate (GtkTreeView *tree_view,
|
||||||
gint row,
|
GtkTreePath *path,
|
||||||
gint column,
|
GtkTreeViewColumn *column,
|
||||||
GdkEventButton *bevent,
|
gpointer user_data);
|
||||||
|
static void gtk_file_selection_file_changed (GtkTreeSelection *selection,
|
||||||
|
gpointer user_data);
|
||||||
|
static void gtk_file_selection_dir_activate (GtkTreeView *tree_view,
|
||||||
|
GtkTreePath *path,
|
||||||
|
GtkTreeViewColumn *column,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
static void gtk_file_selection_dir_button (GtkWidget *widget,
|
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer data);
|
|
||||||
|
|
||||||
static void gtk_file_selection_populate (GtkFileSelection *fs,
|
static void gtk_file_selection_populate (GtkFileSelection *fs,
|
||||||
gchar *rel_path,
|
gchar *rel_path,
|
||||||
@ -600,8 +608,8 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
|||||||
GtkWidget *eventbox;
|
GtkWidget *eventbox;
|
||||||
GtkDialog *dialog;
|
GtkDialog *dialog;
|
||||||
|
|
||||||
char *dir_title [2];
|
GtkListStore *model;
|
||||||
char *file_title [2];
|
GtkTreeViewColumn *column;
|
||||||
|
|
||||||
gtk_widget_push_composite_child ();
|
gtk_widget_push_composite_child ();
|
||||||
|
|
||||||
@ -639,18 +647,31 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
|||||||
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), list_hbox, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), list_hbox, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (list_hbox);
|
gtk_widget_show (list_hbox);
|
||||||
|
|
||||||
/* The directories clist */
|
/* The directories list */
|
||||||
dir_title[0] = _("Directories");
|
|
||||||
dir_title[1] = NULL;
|
model = gtk_list_store_new (1, G_TYPE_STRING);
|
||||||
filesel->dir_list = gtk_clist_new_with_titles (1, (gchar**) dir_title);
|
filesel->dir_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
|
g_object_unref (model);
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes (_("Directories"),
|
||||||
|
gtk_cell_renderer_text_new (),
|
||||||
|
"text", DIR_COLUMN,
|
||||||
|
NULL);
|
||||||
|
label = gtk_label_new_with_mnemonic (_("_Directories"));
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->dir_list);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
gtk_tree_view_column_set_widget (column, label);
|
||||||
|
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->dir_list), column);
|
||||||
|
|
||||||
gtk_widget_set_usize (filesel->dir_list, DIR_LIST_WIDTH, DIR_LIST_HEIGHT);
|
gtk_widget_set_usize (filesel->dir_list, DIR_LIST_WIDTH, DIR_LIST_HEIGHT);
|
||||||
gtk_signal_connect (GTK_OBJECT (filesel->dir_list), "select_row",
|
g_signal_connect (filesel->dir_list, "row_activated",
|
||||||
(GtkSignalFunc) gtk_file_selection_dir_button,
|
G_CALLBACK (gtk_file_selection_dir_activate), filesel);
|
||||||
(gpointer) filesel);
|
|
||||||
gtk_clist_set_column_auto_resize (GTK_CLIST (filesel->dir_list), 0, TRUE);
|
/* gtk_clist_column_titles_passive (GTK_CLIST (filesel->dir_list)); */
|
||||||
gtk_clist_column_titles_passive (GTK_CLIST (filesel->dir_list));
|
|
||||||
|
|
||||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->dir_list);
|
gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->dir_list);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||||
@ -659,18 +680,32 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
|||||||
gtk_widget_show (filesel->dir_list);
|
gtk_widget_show (filesel->dir_list);
|
||||||
gtk_widget_show (scrolled_win);
|
gtk_widget_show (scrolled_win);
|
||||||
|
|
||||||
/* The files clist */
|
/* The files list */
|
||||||
file_title[0] = _("Files");
|
model = gtk_list_store_new (1, G_TYPE_STRING);
|
||||||
file_title[1] = NULL;
|
filesel->file_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
filesel->file_list = gtk_clist_new_with_titles (1, (gchar**) file_title);
|
g_object_unref (model);
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes (_("Files"),
|
||||||
|
gtk_cell_renderer_text_new (),
|
||||||
|
"text", FILE_COLUMN,
|
||||||
|
NULL);
|
||||||
|
label = gtk_label_new_with_mnemonic (_("_Files"));
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), filesel->file_list);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
gtk_tree_view_column_set_widget (column, label);
|
||||||
|
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (filesel->file_list), column);
|
||||||
|
|
||||||
gtk_widget_set_usize (filesel->file_list, FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
|
gtk_widget_set_usize (filesel->file_list, FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
|
||||||
gtk_signal_connect (GTK_OBJECT (filesel->file_list), "select_row",
|
g_signal_connect (filesel->file_list, "row_activated",
|
||||||
(GtkSignalFunc) gtk_file_selection_file_button,
|
G_CALLBACK (gtk_file_selection_file_activate), filesel);
|
||||||
(gpointer) filesel);
|
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (filesel->file_list)), "changed",
|
||||||
gtk_clist_set_column_auto_resize (GTK_CLIST (filesel->file_list), 0, TRUE);
|
G_CALLBACK (gtk_file_selection_file_changed), filesel);
|
||||||
gtk_clist_column_titles_passive (GTK_CLIST (filesel->file_list));
|
|
||||||
|
/* gtk_clist_column_titles_passive (GTK_CLIST (filesel->file_list)); */
|
||||||
|
|
||||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->file_list);
|
gtk_container_add (GTK_CONTAINER (scrolled_win), filesel->file_list);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||||
@ -984,7 +1019,7 @@ gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
|
|||||||
/* delete, create directory, and rename */
|
/* delete, create directory, and rename */
|
||||||
if (!filesel->fileop_c_dir)
|
if (!filesel->fileop_c_dir)
|
||||||
{
|
{
|
||||||
filesel->fileop_c_dir = gtk_button_new_with_label (_("Create Dir"));
|
filesel->fileop_c_dir = gtk_button_new_with_mnemonic (_("Crea_te Dir"));
|
||||||
gtk_signal_connect (GTK_OBJECT (filesel->fileop_c_dir), "clicked",
|
gtk_signal_connect (GTK_OBJECT (filesel->fileop_c_dir), "clicked",
|
||||||
(GtkSignalFunc) gtk_file_selection_create_dir,
|
(GtkSignalFunc) gtk_file_selection_create_dir,
|
||||||
(gpointer) filesel);
|
(gpointer) filesel);
|
||||||
@ -995,7 +1030,7 @@ gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
|
|||||||
|
|
||||||
if (!filesel->fileop_del_file)
|
if (!filesel->fileop_del_file)
|
||||||
{
|
{
|
||||||
filesel->fileop_del_file = gtk_button_new_with_label (_("Delete File"));
|
filesel->fileop_del_file = gtk_button_new_with_mnemonic (_("De_lete File"));
|
||||||
gtk_signal_connect (GTK_OBJECT (filesel->fileop_del_file), "clicked",
|
gtk_signal_connect (GTK_OBJECT (filesel->fileop_del_file), "clicked",
|
||||||
(GtkSignalFunc) gtk_file_selection_delete_file,
|
(GtkSignalFunc) gtk_file_selection_delete_file,
|
||||||
(gpointer) filesel);
|
(gpointer) filesel);
|
||||||
@ -1006,7 +1041,7 @@ gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
|
|||||||
|
|
||||||
if (!filesel->fileop_ren_file)
|
if (!filesel->fileop_ren_file)
|
||||||
{
|
{
|
||||||
filesel->fileop_ren_file = gtk_button_new_with_label (_("Rename File"));
|
filesel->fileop_ren_file = gtk_button_new_with_mnemonic (_("_Rename File"));
|
||||||
gtk_signal_connect (GTK_OBJECT (filesel->fileop_ren_file), "clicked",
|
gtk_signal_connect (GTK_OBJECT (filesel->fileop_ren_file), "clicked",
|
||||||
(GtkSignalFunc) gtk_file_selection_rename_file,
|
(GtkSignalFunc) gtk_file_selection_rename_file,
|
||||||
(gpointer) filesel);
|
(gpointer) filesel);
|
||||||
@ -1301,6 +1336,7 @@ gtk_file_selection_create_dir (GtkWidget *widget,
|
|||||||
(gpointer) fs);
|
(gpointer) fs);
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Create Directory"));
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Create Directory"));
|
||||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fs));
|
||||||
|
|
||||||
/* If file dialog is grabbed, grab option dialog */
|
/* If file dialog is grabbed, grab option dialog */
|
||||||
/* When option dialog is closed, file dialog will be grabbed again */
|
/* When option dialog is closed, file dialog will be grabbed again */
|
||||||
@ -1435,6 +1471,7 @@ gtk_file_selection_delete_file (GtkWidget *widget,
|
|||||||
(gpointer) fs);
|
(gpointer) fs);
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Delete File"));
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Delete File"));
|
||||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fs));
|
||||||
|
|
||||||
/* If file dialog is grabbed, grab option dialog */
|
/* If file dialog is grabbed, grab option dialog */
|
||||||
/* When option dialog is closed, file dialog will be grabbed again */
|
/* When option dialog is closed, file dialog will be grabbed again */
|
||||||
@ -1581,6 +1618,7 @@ gtk_file_selection_rename_file (GtkWidget *widget,
|
|||||||
(gpointer) fs);
|
(gpointer) fs);
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Rename File"));
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Rename File"));
|
||||||
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fs));
|
||||||
|
|
||||||
/* If file dialog is grabbed, grab option dialog */
|
/* If file dialog is grabbed, grab option dialog */
|
||||||
/* When option dialog closed, file dialog will be grabbed again */
|
/* When option dialog closed, file dialog will be grabbed again */
|
||||||
@ -1670,9 +1708,8 @@ gtk_file_selection_key_press (GtkWidget *widget,
|
|||||||
g_return_val_if_fail (widget != NULL, FALSE);
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
g_return_val_if_fail (event != NULL, FALSE);
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
|
||||||
if (event->keyval == GDK_Tab ||
|
if ((event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab) &&
|
||||||
event->keyval == GDK_ISO_Left_Tab ||
|
(event->state & gtk_accelerator_get_default_mod_mask ()) == 0)
|
||||||
event->keyval == GDK_KP_Tab)
|
|
||||||
{
|
{
|
||||||
fs = GTK_FILE_SELECTION (user_data);
|
fs = GTK_FILE_SELECTION (user_data);
|
||||||
#ifdef G_WITH_CYGWIN
|
#ifdef G_WITH_CYGWIN
|
||||||
@ -1796,24 +1833,9 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs,
|
|||||||
g_free (current_dir);
|
g_free (current_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gchar *
|
||||||
gtk_file_selection_file_button (GtkWidget *widget,
|
get_real_filename (gchar *filename)
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
GtkFileSelection *fs = NULL;
|
|
||||||
gchar *filename, *temp = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CLIST (widget));
|
|
||||||
|
|
||||||
fs = user_data;
|
|
||||||
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
||||||
|
|
||||||
gtk_clist_get_text (GTK_CLIST (fs->file_list), row, 0, &temp);
|
|
||||||
filename = g_strdup (temp);
|
|
||||||
|
|
||||||
#ifdef G_WITH_CYGWIN
|
#ifdef G_WITH_CYGWIN
|
||||||
/* Check to see if the selection was a drive selector */
|
/* Check to see if the selection was a drive selector */
|
||||||
if (isalpha (filename[0]) && (filename[1] == ':'))
|
if (isalpha (filename[0]) && (filename[1] == ':'))
|
||||||
@ -1821,24 +1843,49 @@ gtk_file_selection_file_button (GtkWidget *widget,
|
|||||||
/* It is... map it to a CYGWIN32 drive */
|
/* It is... map it to a CYGWIN32 drive */
|
||||||
gchar *temp_filename = g_strdup_printf ("//%c/", tolower (filename[0]));
|
gchar *temp_filename = g_strdup_printf ("//%c/", tolower (filename[0]));
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
filename = temp_filename;
|
return temp_filename;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
return filename;
|
||||||
#endif /* G_WITH_CYGWIN */
|
#endif /* G_WITH_CYGWIN */
|
||||||
|
}
|
||||||
|
|
||||||
if (filename)
|
static void
|
||||||
{
|
gtk_file_selection_file_activate (GtkTreeView *tree_view,
|
||||||
if (bevent)
|
GtkTreePath *path,
|
||||||
switch (bevent->type)
|
GtkTreeViewColumn *column,
|
||||||
{
|
gpointer user_data)
|
||||||
case GDK_2BUTTON_PRESS:
|
{
|
||||||
gtk_button_clicked (GTK_BUTTON (fs->ok_button));
|
GtkFileSelection *fs = GTK_FILE_SELECTION (user_data);
|
||||||
break;
|
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
|
||||||
|
GtkTreeIter iter;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gtk_tree_model_get_iter (model, &iter, path);
|
||||||
|
gtk_tree_model_get (model, &iter, FILE_COLUMN, &filename, -1);
|
||||||
|
filename = get_real_filename (filename);
|
||||||
|
|
||||||
default:
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
||||||
break;
|
gtk_button_clicked (GTK_BUTTON (fs->ok_button));
|
||||||
}
|
|
||||||
else
|
g_free (filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_file_selection_file_changed (GtkTreeSelection *selection,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkFileSelection *fs = GTK_FILE_SELECTION (user_data);
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||||
|
{
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, &iter, FILE_COLUMN, &filename, -1);
|
||||||
|
filename = get_real_filename (filename);
|
||||||
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
@ -1846,37 +1893,32 @@ gtk_file_selection_file_button (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_file_selection_dir_button (GtkWidget *widget,
|
gtk_file_selection_dir_activate (GtkTreeView *tree_view,
|
||||||
gint row,
|
GtkTreePath *path,
|
||||||
gint column,
|
GtkTreeViewColumn *column,
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkFileSelection *fs = NULL;
|
GtkFileSelection *fs = GTK_FILE_SELECTION (user_data);
|
||||||
gchar *filename = NULL;
|
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
|
||||||
|
GtkTreeIter iter;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CLIST (widget));
|
gtk_tree_model_get_iter (model, &iter, path);
|
||||||
|
gtk_tree_model_get (model, &iter, DIR_COLUMN, &filename, -1);
|
||||||
fs = GTK_FILE_SELECTION (user_data);
|
|
||||||
g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
|
|
||||||
|
|
||||||
gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &filename);
|
|
||||||
|
|
||||||
if (filename && bevent && bevent->type == GDK_2BUTTON_PRESS)
|
|
||||||
gtk_file_selection_populate (fs, filename, FALSE, FALSE);
|
gtk_file_selection_populate (fs, filename, FALSE, FALSE);
|
||||||
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
|
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
win32_gtk_add_drives_to_dir_list (GtkWidget *the_dir_list)
|
win32_gtk_add_drives_to_dir_list (GtkListStore *model)
|
||||||
{
|
{
|
||||||
gchar *text[2], *textPtr;
|
gchar *textPtr;
|
||||||
gchar buffer[128];
|
gchar buffer[128];
|
||||||
char volumeNameBuf[128];
|
char volumeNameBuf[128];
|
||||||
char formatBuffer[128];
|
char formatBuffer[128];
|
||||||
|
GtkTreeIter iter;
|
||||||
text[1] = NULL;
|
|
||||||
|
|
||||||
/* Get the Drives string */
|
/* Get the Drives string */
|
||||||
GetLogicalDriveStrings (sizeof (buffer), buffer);
|
GetLogicalDriveStrings (sizeof (buffer), buffer);
|
||||||
@ -1902,8 +1944,8 @@ win32_gtk_add_drives_to_dir_list (GtkWidget *the_dir_list)
|
|||||||
sprintf (formatBuffer, "%s (%s)", formatBuffer, volumeNameBuf);
|
sprintf (formatBuffer, "%s (%s)", formatBuffer, volumeNameBuf);
|
||||||
#endif
|
#endif
|
||||||
/* Add to the list */
|
/* Add to the list */
|
||||||
text[0] = formatBuffer;
|
gtk_list_store_append (model, &iter);
|
||||||
gtk_clist_append (GTK_CLIST (the_dir_list), text);
|
gtk_list_store_set (model, &iter, DIR_COLUMN, formatBuffer, -1);
|
||||||
}
|
}
|
||||||
textPtr += (strlen (textPtr) + 1);
|
textPtr += (strlen (textPtr) + 1);
|
||||||
}
|
}
|
||||||
@ -1918,10 +1960,12 @@ gtk_file_selection_populate (GtkFileSelection *fs,
|
|||||||
{
|
{
|
||||||
CompletionState *cmpl_state;
|
CompletionState *cmpl_state;
|
||||||
PossibleCompletion* poss;
|
PossibleCompletion* poss;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkListStore *dir_model;
|
||||||
|
GtkListStore *file_model;
|
||||||
gchar* filename;
|
gchar* filename;
|
||||||
gchar* rem_path = rel_path;
|
gchar* rem_path = rel_path;
|
||||||
gchar* sel_text;
|
gchar* sel_text;
|
||||||
gchar* text[2];
|
|
||||||
gint did_recurse = FALSE;
|
gint did_recurse = FALSE;
|
||||||
gint possible_count = 0;
|
gint possible_count = 0;
|
||||||
gint selection_index = -1;
|
gint selection_index = -1;
|
||||||
@ -1940,18 +1984,17 @@ gtk_file_selection_populate (GtkFileSelection *fs,
|
|||||||
|
|
||||||
g_assert (cmpl_state->reference_dir);
|
g_assert (cmpl_state->reference_dir);
|
||||||
|
|
||||||
gtk_clist_freeze (GTK_CLIST (fs->dir_list));
|
dir_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->dir_list)));
|
||||||
gtk_clist_clear (GTK_CLIST (fs->dir_list));
|
file_model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fs->file_list)));
|
||||||
gtk_clist_freeze (GTK_CLIST (fs->file_list));
|
|
||||||
gtk_clist_clear (GTK_CLIST (fs->file_list));
|
|
||||||
|
|
||||||
/* Set the dir_list to include ./ and ../ */
|
gtk_list_store_clear (dir_model);
|
||||||
text[1] = NULL;
|
gtk_list_store_clear (file_model);
|
||||||
text[0] = "." G_DIR_SEPARATOR_S;
|
|
||||||
gtk_clist_append (GTK_CLIST (fs->dir_list), text);
|
|
||||||
|
|
||||||
text[0] = ".." G_DIR_SEPARATOR_S;
|
/* Set the dir list to include ./ and ../ */
|
||||||
gtk_clist_append (GTK_CLIST (fs->dir_list), text);
|
gtk_list_store_append (dir_model, &iter);
|
||||||
|
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, "." G_DIR_SEPARATOR_S, -1);
|
||||||
|
gtk_list_store_append (dir_model, &iter);
|
||||||
|
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, ".." G_DIR_SEPARATOR_S, -1);
|
||||||
|
|
||||||
while (poss)
|
while (poss)
|
||||||
{
|
{
|
||||||
@ -1961,17 +2004,19 @@ gtk_file_selection_populate (GtkFileSelection *fs,
|
|||||||
|
|
||||||
filename = cmpl_this_completion (poss);
|
filename = cmpl_this_completion (poss);
|
||||||
|
|
||||||
text[0] = filename;
|
|
||||||
|
|
||||||
if (cmpl_is_directory (poss))
|
if (cmpl_is_directory (poss))
|
||||||
{
|
{
|
||||||
if (strcmp (filename, "." G_DIR_SEPARATOR_S) != 0 &&
|
if (strcmp (filename, "." G_DIR_SEPARATOR_S) != 0 &&
|
||||||
strcmp (filename, ".." G_DIR_SEPARATOR_S) != 0)
|
strcmp (filename, ".." G_DIR_SEPARATOR_S) != 0)
|
||||||
gtk_clist_append (GTK_CLIST (fs->dir_list), text);
|
{
|
||||||
|
gtk_list_store_append (dir_model, &iter);
|
||||||
|
gtk_list_store_set (dir_model, &iter, DIR_COLUMN, filename, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_clist_append (GTK_CLIST (fs->file_list), text);
|
gtk_list_store_append (file_model, &iter);
|
||||||
|
gtk_list_store_set (file_model, &iter, DIR_COLUMN, filename, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1980,12 +2025,9 @@ gtk_file_selection_populate (GtkFileSelection *fs,
|
|||||||
|
|
||||||
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
|
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
|
||||||
/* For Windows, add drives as potential selections */
|
/* For Windows, add drives as potential selections */
|
||||||
win32_gtk_add_drives_to_dir_list (fs->dir_list);
|
win32_gtk_add_drives_to_dir_list (dir_model);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gtk_clist_thaw (GTK_CLIST (fs->dir_list));
|
|
||||||
gtk_clist_thaw (GTK_CLIST (fs->file_list));
|
|
||||||
|
|
||||||
/* File lists are set. */
|
/* File lists are set. */
|
||||||
|
|
||||||
g_assert (cmpl_state->reference_dir);
|
g_assert (cmpl_state->reference_dir);
|
||||||
|
540
gtk/gtkfontsel.c
540
gtk/gtkfontsel.c
@ -40,16 +40,19 @@
|
|||||||
#include "gtkfontsel.h"
|
#include "gtkfontsel.h"
|
||||||
|
|
||||||
#include "gtkbutton.h"
|
#include "gtkbutton.h"
|
||||||
#include "gtkclist.h"
|
#include "gtkcellrenderertext.h"
|
||||||
#include "gtkentry.h"
|
#include "gtkentry.h"
|
||||||
#include "gtkframe.h"
|
#include "gtkframe.h"
|
||||||
#include "gtkhbbox.h"
|
#include "gtkhbbox.h"
|
||||||
#include "gtkhbox.h"
|
#include "gtkhbox.h"
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
|
#include "gtkliststore.h"
|
||||||
#include "gtkrc.h"
|
#include "gtkrc.h"
|
||||||
#include "gtksignal.h"
|
#include "gtksignal.h"
|
||||||
#include "gtkstock.h"
|
#include "gtkstock.h"
|
||||||
#include "gtktable.h"
|
#include "gtktable.h"
|
||||||
|
#include "gtktreeselection.h"
|
||||||
|
#include "gtktreeview.h"
|
||||||
#include "gtkvbox.h"
|
#include "gtkvbox.h"
|
||||||
#include "gtkscrolledwindow.h"
|
#include "gtkscrolledwindow.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
@ -63,13 +66,13 @@
|
|||||||
#define INITIAL_PREVIEW_HEIGHT 44
|
#define INITIAL_PREVIEW_HEIGHT 44
|
||||||
#define MAX_PREVIEW_HEIGHT 300
|
#define MAX_PREVIEW_HEIGHT 300
|
||||||
|
|
||||||
/* These are the sizes of the font, style & size clists. */
|
/* These are the sizes of the font, style & size lists. */
|
||||||
#define FONT_LIST_HEIGHT 136
|
#define FONT_LIST_HEIGHT 136
|
||||||
#define FONT_LIST_WIDTH 190
|
#define FONT_LIST_WIDTH 190
|
||||||
#define FONT_STYLE_LIST_WIDTH 170
|
#define FONT_STYLE_LIST_WIDTH 170
|
||||||
#define FONT_SIZE_LIST_WIDTH 60
|
#define FONT_SIZE_LIST_WIDTH 60
|
||||||
|
|
||||||
/* These are what we use as the standard font sizes, for the size clist.
|
/* These are what we use as the standard font sizes, for the size list.
|
||||||
*/
|
*/
|
||||||
static const guint16 font_sizes[] = {
|
static const guint16 font_sizes[] = {
|
||||||
8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 26, 28,
|
8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 26, 28,
|
||||||
@ -83,6 +86,21 @@ enum {
|
|||||||
PROP_PREVIEW_TEXT
|
PROP_PREVIEW_TEXT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FAMILY_COLUMN,
|
||||||
|
FAMILY_NAME_COLUMN
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FACE_COLUMN,
|
||||||
|
FACE_NAME_COLUMN
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SIZE_COLUMN
|
||||||
|
};
|
||||||
|
|
||||||
static void gtk_font_selection_class_init (GtkFontSelectionClass *klass);
|
static void gtk_font_selection_class_init (GtkFontSelectionClass *klass);
|
||||||
static void gtk_font_selection_set_property (GObject *object,
|
static void gtk_font_selection_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -96,30 +114,22 @@ static void gtk_font_selection_init (GtkFontSelection *fontsel);
|
|||||||
static void gtk_font_selection_finalize (GObject *object);
|
static void gtk_font_selection_finalize (GObject *object);
|
||||||
|
|
||||||
/* These are the callbacks & related functions. */
|
/* These are the callbacks & related functions. */
|
||||||
static void gtk_font_selection_select_font (GtkWidget *w,
|
static void gtk_font_selection_select_font (GtkTreeSelection *selection,
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void gtk_font_selection_show_available_fonts (GtkFontSelection *fs);
|
static void gtk_font_selection_show_available_fonts (GtkFontSelection *fs);
|
||||||
|
|
||||||
static void gtk_font_selection_show_available_styles (GtkFontSelection *fs);
|
static void gtk_font_selection_show_available_styles (GtkFontSelection *fs);
|
||||||
static void gtk_font_selection_select_best_style (GtkFontSelection *fs,
|
static void gtk_font_selection_select_best_style (GtkFontSelection *fs,
|
||||||
gboolean use_first);
|
gboolean use_first);
|
||||||
static void gtk_font_selection_select_style (GtkWidget *w,
|
static void gtk_font_selection_select_style (GtkTreeSelection *selection,
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void gtk_font_selection_select_best_size (GtkFontSelection *fs);
|
static void gtk_font_selection_select_best_size (GtkFontSelection *fs);
|
||||||
static void gtk_font_selection_show_available_sizes (GtkFontSelection *fs);
|
static void gtk_font_selection_show_available_sizes (GtkFontSelection *fs,
|
||||||
|
gboolean first_time);
|
||||||
static void gtk_font_selection_size_activate (GtkWidget *w,
|
static void gtk_font_selection_size_activate (GtkWidget *w,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void gtk_font_selection_select_size (GtkWidget *w,
|
static void gtk_font_selection_select_size (GtkTreeSelection *selection,
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void gtk_font_selection_scroll_on_map (GtkWidget *w,
|
static void gtk_font_selection_scroll_on_map (GtkWidget *w,
|
||||||
@ -261,6 +271,10 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
|
|||||||
GtkWidget *text_frame;
|
GtkWidget *text_frame;
|
||||||
GtkWidget *text_box;
|
GtkWidget *text_box;
|
||||||
GtkWidget *table, *label;
|
GtkWidget *table, *label;
|
||||||
|
GtkWidget *font_label, *style_label;
|
||||||
|
GtkListStore *model;
|
||||||
|
GtkTreeViewColumn *column;
|
||||||
|
GList *focus_chain = NULL;
|
||||||
|
|
||||||
gtk_widget_push_composite_child ();
|
gtk_widget_push_composite_child ();
|
||||||
|
|
||||||
@ -275,14 +289,14 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
|
|||||||
fontsel->font_entry = gtk_entry_new ();
|
fontsel->font_entry = gtk_entry_new ();
|
||||||
gtk_entry_set_editable (GTK_ENTRY (fontsel->font_entry), FALSE);
|
gtk_entry_set_editable (GTK_ENTRY (fontsel->font_entry), FALSE);
|
||||||
gtk_widget_set_usize (fontsel->font_entry, 20, -1);
|
gtk_widget_set_usize (fontsel->font_entry, 20, -1);
|
||||||
gtk_widget_show (fontsel->font_entry);
|
/* gtk_widget_show (fontsel->font_entry); */
|
||||||
gtk_table_attach (GTK_TABLE (table), fontsel->font_entry, 0, 1, 1, 2,
|
gtk_table_attach (GTK_TABLE (table), fontsel->font_entry, 0, 1, 1, 2,
|
||||||
GTK_FILL, 0, 0, 0);
|
GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
fontsel->font_style_entry = gtk_entry_new ();
|
fontsel->font_style_entry = gtk_entry_new ();
|
||||||
gtk_entry_set_editable (GTK_ENTRY (fontsel->font_style_entry), FALSE);
|
gtk_entry_set_editable (GTK_ENTRY (fontsel->font_style_entry), FALSE);
|
||||||
gtk_widget_set_usize (fontsel->font_style_entry, 20, -1);
|
gtk_widget_set_usize (fontsel->font_style_entry, 20, -1);
|
||||||
gtk_widget_show (fontsel->font_style_entry);
|
/* gtk_widget_show (fontsel->font_style_entry); */
|
||||||
gtk_table_attach (GTK_TABLE (table), fontsel->font_style_entry, 1, 2, 1, 2,
|
gtk_table_attach (GTK_TABLE (table), fontsel->font_style_entry, 1, 2, 1, 2,
|
||||||
GTK_FILL, 0, 0, 0);
|
GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
@ -295,20 +309,18 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
|
|||||||
(GtkSignalFunc) gtk_font_selection_size_activate,
|
(GtkSignalFunc) gtk_font_selection_size_activate,
|
||||||
fontsel);
|
fontsel);
|
||||||
|
|
||||||
fontsel->font_label = gtk_label_new_with_mnemonic (_("_Family:"));
|
font_label = gtk_label_new_with_mnemonic (_("_Family:"));
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (fontsel->font_label),
|
gtk_misc_set_alignment (GTK_MISC (font_label), 0.0, 0.5);
|
||||||
fontsel->font_entry);
|
gtk_widget_show (font_label);
|
||||||
gtk_misc_set_alignment (GTK_MISC (fontsel->font_label), 0.0, 0.5);
|
gtk_table_attach (GTK_TABLE (table), font_label, 0, 1, 0, 1,
|
||||||
gtk_widget_show (fontsel->font_label);
|
|
||||||
gtk_table_attach (GTK_TABLE (table), fontsel->font_label, 0, 1, 0, 1,
|
|
||||||
GTK_FILL, 0, 0, 0);
|
GTK_FILL, 0, 0, 0);
|
||||||
label = gtk_label_new_with_mnemonic (_("_Style:"));
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
style_label = gtk_label_new_with_mnemonic (_("_Style:"));
|
||||||
fontsel->font_style_entry);
|
gtk_misc_set_alignment (GTK_MISC (style_label), 0.0, 0.5);
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
gtk_widget_show (style_label);
|
||||||
gtk_widget_show (label);
|
gtk_table_attach (GTK_TABLE (table), style_label, 1, 2, 0, 1,
|
||||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1,
|
|
||||||
GTK_FILL, 0, 0, 0);
|
GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
label = gtk_label_new_with_mnemonic (_("Si_ze:"));
|
label = gtk_label_new_with_mnemonic (_("Si_ze:"));
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
||||||
fontsel->size_entry);
|
fontsel->size_entry);
|
||||||
@ -318,76 +330,124 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
|
|||||||
GTK_FILL, 0, 0, 0);
|
GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
/* Create the clists */
|
/* Create the lists */
|
||||||
fontsel->font_clist = gtk_clist_new (1);
|
|
||||||
gtk_clist_column_titles_hide (GTK_CLIST (fontsel->font_clist));
|
model = gtk_list_store_new (2,
|
||||||
gtk_clist_set_column_auto_resize (GTK_CLIST (fontsel->font_clist), 0, TRUE);
|
G_TYPE_OBJECT, /* FAMILY_COLUMN */
|
||||||
|
G_TYPE_STRING); /* FAMILY_NAME_COLUMN */
|
||||||
|
fontsel->family_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
|
g_object_unref (model);
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes ("Family",
|
||||||
|
gtk_cell_renderer_text_new (),
|
||||||
|
"text", FAMILY_NAME_COLUMN,
|
||||||
|
NULL);
|
||||||
|
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (fontsel->family_list), column);
|
||||||
|
|
||||||
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (fontsel->family_list), FALSE);
|
||||||
|
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list)),
|
||||||
|
GTK_SELECTION_BROWSE);
|
||||||
|
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (font_label), fontsel->family_list);
|
||||||
|
|
||||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
|
||||||
gtk_widget_set_usize (scrolled_win, FONT_LIST_WIDTH, FONT_LIST_HEIGHT);
|
gtk_widget_set_usize (scrolled_win, FONT_LIST_WIDTH, FONT_LIST_HEIGHT);
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->font_clist);
|
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->family_list);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||||
gtk_widget_show (fontsel->font_clist);
|
gtk_widget_show (fontsel->family_list);
|
||||||
gtk_widget_show (scrolled_win);
|
gtk_widget_show (scrolled_win);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), scrolled_win, 0, 1, 2, 3,
|
gtk_table_attach (GTK_TABLE (table), scrolled_win, 0, 1, 1, 3,
|
||||||
GTK_EXPAND | GTK_FILL,
|
GTK_EXPAND | GTK_FILL,
|
||||||
GTK_EXPAND | GTK_FILL, 0, 0);
|
GTK_EXPAND | GTK_FILL, 0, 0);
|
||||||
|
focus_chain = g_list_append (focus_chain, scrolled_win);
|
||||||
|
|
||||||
|
model = gtk_list_store_new (2,
|
||||||
|
G_TYPE_OBJECT, /* FACE_COLUMN */
|
||||||
|
G_TYPE_STRING); /* FACE_NAME_COLUMN */
|
||||||
|
fontsel->face_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
|
g_object_unref (model);
|
||||||
|
|
||||||
|
gtk_label_set_mnemonic_widget (GTK_LABEL (style_label), fontsel->face_list);
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes ("Face",
|
||||||
|
gtk_cell_renderer_text_new (),
|
||||||
|
"text", FACE_NAME_COLUMN,
|
||||||
|
NULL);
|
||||||
|
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (fontsel->face_list), column);
|
||||||
|
|
||||||
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (fontsel->face_list), FALSE);
|
||||||
|
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list)),
|
||||||
|
GTK_SELECTION_BROWSE);
|
||||||
|
|
||||||
fontsel->font_style_clist = gtk_clist_new (1);
|
|
||||||
gtk_clist_column_titles_hide (GTK_CLIST (fontsel->font_style_clist));
|
|
||||||
gtk_clist_set_column_auto_resize (GTK_CLIST (fontsel->font_style_clist),
|
|
||||||
0, TRUE);
|
|
||||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_widget_set_usize (scrolled_win, FONT_STYLE_LIST_WIDTH, -1);
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->font_style_clist);
|
gtk_widget_set_usize (scrolled_win, FONT_STYLE_LIST_WIDTH, FONT_LIST_HEIGHT);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->face_list);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||||
gtk_widget_show (fontsel->font_style_clist);
|
gtk_widget_show (fontsel->face_list);
|
||||||
gtk_widget_show (scrolled_win);
|
gtk_widget_show (scrolled_win);
|
||||||
gtk_table_attach (GTK_TABLE (table), scrolled_win, 1, 2, 2, 3,
|
gtk_table_attach (GTK_TABLE (table), scrolled_win, 1, 2, 1, 3,
|
||||||
GTK_EXPAND | GTK_FILL,
|
GTK_EXPAND | GTK_FILL,
|
||||||
GTK_EXPAND | GTK_FILL, 0, 0);
|
GTK_EXPAND | GTK_FILL, 0, 0);
|
||||||
|
focus_chain = g_list_append (focus_chain, scrolled_win);
|
||||||
|
|
||||||
|
focus_chain = g_list_append (focus_chain, fontsel->size_entry);
|
||||||
|
|
||||||
|
model = gtk_list_store_new (1, G_TYPE_INT);
|
||||||
|
fontsel->size_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
|
g_object_unref (model);
|
||||||
|
|
||||||
|
column = gtk_tree_view_column_new_with_attributes ("Size",
|
||||||
|
gtk_cell_renderer_text_new (),
|
||||||
|
"text", SIZE_COLUMN,
|
||||||
|
NULL);
|
||||||
|
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (fontsel->size_list), column);
|
||||||
|
|
||||||
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (fontsel->size_list), FALSE);
|
||||||
|
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list)),
|
||||||
|
GTK_SELECTION_BROWSE);
|
||||||
|
|
||||||
fontsel->size_clist = gtk_clist_new (1);
|
|
||||||
gtk_clist_column_titles_hide (GTK_CLIST (fontsel->size_clist));
|
|
||||||
gtk_clist_set_column_width (GTK_CLIST (fontsel->size_clist), 0, 20);
|
|
||||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_widget_set_usize (scrolled_win, FONT_SIZE_LIST_WIDTH, -1);
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->size_clist);
|
gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->size_list);
|
||||||
|
gtk_widget_set_usize (scrolled_win, -1, FONT_LIST_HEIGHT);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||||
gtk_widget_show (fontsel->size_clist);
|
gtk_widget_show (fontsel->size_list);
|
||||||
gtk_widget_show (scrolled_win);
|
gtk_widget_show (scrolled_win);
|
||||||
gtk_table_attach (GTK_TABLE (table), scrolled_win, 2, 3, 2, 3,
|
gtk_table_attach (GTK_TABLE (table), scrolled_win, 2, 3, 2, 3,
|
||||||
GTK_FILL, GTK_FILL, 0, 0);
|
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||||
|
focus_chain = g_list_append (focus_chain, scrolled_win);
|
||||||
|
|
||||||
/* Insert the fonts. If there exist fonts with the same family but
|
gtk_container_set_focus_chain (GTK_CONTAINER (table), focus_chain);
|
||||||
different foundries, then the foundry name is appended in brackets. */
|
g_list_free (focus_chain);
|
||||||
|
|
||||||
|
/* Insert the fonts. */
|
||||||
gtk_font_selection_show_available_fonts (fontsel);
|
gtk_font_selection_show_available_fonts (fontsel);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (fontsel->font_clist), "select_row",
|
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list)), "changed",
|
||||||
GTK_SIGNAL_FUNC (gtk_font_selection_select_font),
|
G_CALLBACK (gtk_font_selection_select_font), fontsel);
|
||||||
fontsel);
|
|
||||||
GTK_WIDGET_SET_FLAGS (fontsel->font_clist, GTK_CAN_FOCUS);
|
|
||||||
|
|
||||||
gtk_signal_connect_after (GTK_OBJECT (fontsel->font_clist), "map",
|
gtk_signal_connect_after (GTK_OBJECT (fontsel->family_list), "map",
|
||||||
GTK_SIGNAL_FUNC (gtk_font_selection_scroll_on_map),
|
GTK_SIGNAL_FUNC (gtk_font_selection_scroll_on_map),
|
||||||
fontsel);
|
fontsel);
|
||||||
|
|
||||||
gtk_font_selection_show_available_styles (fontsel);
|
gtk_font_selection_show_available_styles (fontsel);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (fontsel->font_style_clist), "select_row",
|
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list)), "changed",
|
||||||
GTK_SIGNAL_FUNC (gtk_font_selection_select_style),
|
G_CALLBACK (gtk_font_selection_select_style), fontsel);
|
||||||
fontsel);
|
|
||||||
GTK_WIDGET_SET_FLAGS (fontsel->font_style_clist, GTK_CAN_FOCUS);
|
|
||||||
|
|
||||||
gtk_font_selection_show_available_sizes (fontsel);
|
gtk_font_selection_show_available_sizes (fontsel, TRUE);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (fontsel->size_clist), "select_row",
|
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list)), "changed",
|
||||||
GTK_SIGNAL_FUNC (gtk_font_selection_select_size),
|
G_CALLBACK (gtk_font_selection_select_size), fontsel);
|
||||||
fontsel);
|
|
||||||
GTK_WIDGET_SET_FLAGS (fontsel->size_clist, GTK_CAN_FOCUS);
|
|
||||||
|
|
||||||
/* create the text entry widget */
|
/* create the text entry widget */
|
||||||
text_frame = gtk_frame_new (_("Preview:"));
|
text_frame = gtk_frame_new (_("Preview:"));
|
||||||
@ -435,9 +495,6 @@ gtk_font_selection_finalize (GObject *object)
|
|||||||
|
|
||||||
fontsel = GTK_FONT_SELECTION (object);
|
fontsel = GTK_FONT_SELECTION (object);
|
||||||
|
|
||||||
g_free (fontsel->families);
|
|
||||||
g_free (fontsel->faces);
|
|
||||||
|
|
||||||
if (fontsel->font)
|
if (fontsel->font)
|
||||||
gdk_font_unref (fontsel->font);
|
gdk_font_unref (fontsel->font);
|
||||||
|
|
||||||
@ -452,74 +509,64 @@ gtk_font_selection_preview_changed (GtkWidget *entry,
|
|||||||
g_object_notify (G_OBJECT (fontsel), "preview_text");
|
g_object_notify (G_OBJECT (fontsel), "preview_text");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is called when the clist is mapped. Here we scroll to the current
|
static void
|
||||||
|
scroll_to_selection (GtkTreeView *tree_view)
|
||||||
|
{
|
||||||
|
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||||
|
{
|
||||||
|
GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
|
||||||
|
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5, 0.5);
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is called when the list is mapped. Here we scroll to the current
|
||||||
font if necessary. */
|
font if necessary. */
|
||||||
static void
|
static void
|
||||||
gtk_font_selection_scroll_on_map (GtkWidget *widget,
|
gtk_font_selection_scroll_on_map (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkFontSelection *fontsel;
|
GtkFontSelection *fontsel;
|
||||||
GList *selection;
|
|
||||||
gint index;
|
|
||||||
|
|
||||||
#ifdef FONTSEL_DEBUG
|
#ifdef FONTSEL_DEBUG
|
||||||
g_message ("In expose_list\n");
|
g_message ("In expose_list\n");
|
||||||
#endif
|
#endif
|
||||||
fontsel = GTK_FONT_SELECTION (data);
|
fontsel = GTK_FONT_SELECTION (data);
|
||||||
|
|
||||||
/* Try to scroll the font family clist to the selected item */
|
/* Try to scroll the font family list to the selected item */
|
||||||
selection = GTK_CLIST (fontsel->font_clist)->selection;
|
scroll_to_selection (GTK_TREE_VIEW (fontsel->family_list));
|
||||||
if (selection)
|
|
||||||
{
|
|
||||||
index = GPOINTER_TO_INT (selection->data);
|
|
||||||
if (gtk_clist_row_is_visible (GTK_CLIST (fontsel->font_clist), index)
|
|
||||||
!= GTK_VISIBILITY_FULL)
|
|
||||||
gtk_clist_moveto (GTK_CLIST (fontsel->font_clist), index, -1, 0.5, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try to scroll the font style clist to the selected item */
|
/* Try to scroll the font family list to the selected item */
|
||||||
selection = GTK_CLIST (fontsel->font_style_clist)->selection;
|
scroll_to_selection (GTK_TREE_VIEW (fontsel->face_list));
|
||||||
if (selection)
|
|
||||||
{
|
|
||||||
index = GPOINTER_TO_INT (selection->data);
|
|
||||||
if (gtk_clist_row_is_visible (GTK_CLIST (fontsel->font_style_clist), index)
|
|
||||||
!= GTK_VISIBILITY_FULL)
|
|
||||||
gtk_clist_moveto (GTK_CLIST (fontsel->font_style_clist), index, -1,
|
|
||||||
0.5, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try to scroll the font size clist to the selected item */
|
/* Try to scroll the font family list to the selected item */
|
||||||
selection = GTK_CLIST (fontsel->size_clist)->selection;
|
scroll_to_selection (GTK_TREE_VIEW (fontsel->size_list));
|
||||||
if (selection)
|
|
||||||
{
|
|
||||||
index = GPOINTER_TO_INT (selection->data);
|
|
||||||
if (gtk_clist_row_is_visible (GTK_CLIST (fontsel->size_clist), index)
|
|
||||||
!= GTK_VISIBILITY_FULL)
|
|
||||||
gtk_clist_moveto (GTK_CLIST (fontsel->size_clist), index, -1, 0.5, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is called when a family is selected in the list. */
|
/* This is called when a family is selected in the list. */
|
||||||
static void
|
static void
|
||||||
gtk_font_selection_select_font (GtkWidget *w,
|
gtk_font_selection_select_font (GtkTreeSelection *selection,
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkFontSelection *fontsel;
|
GtkFontSelection *fontsel;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
const gchar *family_name;
|
const gchar *family_name;
|
||||||
gint index;
|
|
||||||
|
|
||||||
fontsel = GTK_FONT_SELECTION (data);
|
fontsel = GTK_FONT_SELECTION (data);
|
||||||
|
|
||||||
if (GTK_CLIST (fontsel->font_clist)->selection)
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||||
{
|
{
|
||||||
index = GPOINTER_TO_INT (GTK_CLIST (fontsel->font_clist)->selection->data);
|
PangoFontFamily *family;
|
||||||
|
|
||||||
if (fontsel->family != fontsel->families[index])
|
gtk_tree_model_get (model, &iter, FAMILY_COLUMN, &family, -1);
|
||||||
|
if (fontsel->family != family)
|
||||||
{
|
{
|
||||||
fontsel->family = fontsel->families[index];
|
fontsel->family = family;
|
||||||
|
|
||||||
family_name = pango_font_family_get_name (fontsel->family);
|
family_name = pango_font_family_get_name (fontsel->family);
|
||||||
|
|
||||||
@ -528,6 +575,8 @@ gtk_font_selection_select_font (GtkWidget *w,
|
|||||||
gtk_font_selection_show_available_styles (fontsel);
|
gtk_font_selection_show_available_styles (fontsel);
|
||||||
gtk_font_selection_select_best_style (fontsel, TRUE);
|
gtk_font_selection_select_best_style (fontsel, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (family);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,35 +592,49 @@ cmp_families (const void *a, const void *b)
|
|||||||
static void
|
static void
|
||||||
gtk_font_selection_show_available_fonts (GtkFontSelection *fontsel)
|
gtk_font_selection_show_available_fonts (GtkFontSelection *fontsel)
|
||||||
{
|
{
|
||||||
|
GtkListStore *model;
|
||||||
|
GtkTreeSelection *selection;
|
||||||
|
PangoFontFamily **families;
|
||||||
|
PangoFontFamily *match_family = NULL;
|
||||||
gint n_families, i;
|
gint n_families, i;
|
||||||
gint match_row = -1;
|
GtkTreeIter match_row;
|
||||||
|
|
||||||
|
model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->family_list)));
|
||||||
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list));
|
||||||
|
|
||||||
pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (fontsel)),
|
pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (fontsel)),
|
||||||
&fontsel->families, &n_families);
|
&families, &n_families);
|
||||||
qsort (fontsel->families, n_families, sizeof (PangoFontFamily *), cmp_families);
|
qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
|
||||||
|
|
||||||
gtk_clist_freeze (GTK_CLIST (fontsel->font_clist));
|
gtk_list_store_clear (model);
|
||||||
gtk_clist_clear (GTK_CLIST (fontsel->font_clist));
|
|
||||||
|
|
||||||
for (i=0; i<n_families; i++)
|
for (i=0; i<n_families; i++)
|
||||||
{
|
{
|
||||||
const gchar *name = pango_font_family_get_name (fontsel->families[i]);
|
const gchar *name = pango_font_family_get_name (families[i]);
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
gtk_clist_append (GTK_CLIST (fontsel->font_clist), (char **)&name);
|
gtk_list_store_append (model, &iter);
|
||||||
|
gtk_list_store_set (model, &iter,
|
||||||
|
FAMILY_COLUMN, families[i],
|
||||||
|
FAMILY_NAME_COLUMN, name,
|
||||||
|
-1);
|
||||||
|
|
||||||
if (!g_strcasecmp (name, "sans"))
|
if (i == 0 || !g_strcasecmp (name, "sans"))
|
||||||
match_row = i;
|
{
|
||||||
|
match_family = families[i];
|
||||||
|
match_row = iter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match_row < 0)
|
fontsel->family = match_family;
|
||||||
match_row = 0;
|
if (match_family)
|
||||||
|
{
|
||||||
gtk_clist_select_row (GTK_CLIST (fontsel->font_clist), match_row, 0);
|
gtk_tree_selection_select_iter (selection, &match_row);
|
||||||
gtk_entry_set_text (GTK_ENTRY (fontsel->font_entry),
|
gtk_entry_set_text (GTK_ENTRY (fontsel->font_entry),
|
||||||
pango_font_family_get_name (fontsel->families[match_row]));
|
pango_font_family_get_name (match_family));
|
||||||
fontsel->family = fontsel->families[match_row];
|
}
|
||||||
|
|
||||||
gtk_clist_thaw (GTK_CLIST (fontsel->font_clist));
|
g_free (families);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -620,41 +683,57 @@ font_description_style_equal (const PangoFontDescription *a,
|
|||||||
pango_font_description_get_variant (a) == pango_font_description_get_variant (b));
|
pango_font_description_get_variant (a) == pango_font_description_get_variant (b));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This fills the font style clist with all the possible style combinations
|
/* This fills the font style list with all the possible style combinations
|
||||||
for the current font family. */
|
for the current font family. */
|
||||||
static void
|
static void
|
||||||
gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
|
gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
|
||||||
{
|
{
|
||||||
gint match_row = -1;
|
|
||||||
gint n_faces, i;
|
gint n_faces, i;
|
||||||
const gchar *str;
|
PangoFontFace **faces;
|
||||||
PangoFontDescription *old_desc;
|
PangoFontDescription *old_desc;
|
||||||
|
GtkTreeSelection *selection;
|
||||||
|
GtkListStore *model;
|
||||||
|
GtkTreeIter match_row;
|
||||||
|
PangoFontFace *match_face = NULL;
|
||||||
|
|
||||||
|
model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->face_list)));
|
||||||
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list));
|
||||||
|
|
||||||
if (fontsel->face)
|
if (fontsel->face)
|
||||||
old_desc = pango_font_face_describe (fontsel->face);
|
old_desc = pango_font_face_describe (fontsel->face);
|
||||||
else
|
else
|
||||||
old_desc= NULL;
|
old_desc= NULL;
|
||||||
|
|
||||||
if (fontsel->faces)
|
pango_font_family_list_faces (fontsel->family, &faces, &n_faces);
|
||||||
g_free (fontsel->faces);
|
qsort (faces, n_faces, sizeof (PangoFontFace *), faces_sort_func);
|
||||||
|
|
||||||
pango_font_family_list_faces (fontsel->family, &fontsel->faces, &n_faces);
|
gtk_list_store_clear (model);
|
||||||
qsort (fontsel->faces, n_faces, sizeof (PangoFontFace *), faces_sort_func);
|
|
||||||
|
|
||||||
gtk_clist_freeze (GTK_CLIST (fontsel->font_style_clist));
|
|
||||||
gtk_clist_clear (GTK_CLIST (fontsel->font_style_clist));
|
|
||||||
|
|
||||||
for (i=0; i < n_faces; i++)
|
for (i=0; i < n_faces; i++)
|
||||||
{
|
{
|
||||||
str = pango_font_face_get_face_name (fontsel->faces[i]);
|
GtkTreeIter iter;
|
||||||
gtk_clist_append (GTK_CLIST (fontsel->font_style_clist), (char **)&str);
|
const gchar *str = pango_font_face_get_face_name (faces[i]);
|
||||||
|
|
||||||
if (old_desc)
|
gtk_list_store_append (model, &iter);
|
||||||
|
gtk_list_store_set (model, &iter,
|
||||||
|
FACE_COLUMN, faces[i],
|
||||||
|
FACE_NAME_COLUMN, str,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
{
|
{
|
||||||
PangoFontDescription *tmp_desc = pango_font_face_describe (fontsel->faces[i]);
|
match_row = iter;
|
||||||
|
match_face = faces[i];
|
||||||
|
}
|
||||||
|
else if (old_desc)
|
||||||
|
{
|
||||||
|
PangoFontDescription *tmp_desc = pango_font_face_describe (faces[i]);
|
||||||
|
|
||||||
if (font_description_style_equal (tmp_desc, old_desc))
|
if (font_description_style_equal (tmp_desc, old_desc))
|
||||||
match_row = i;
|
{
|
||||||
|
match_row = iter;
|
||||||
|
match_face = faces[i];
|
||||||
|
}
|
||||||
|
|
||||||
pango_font_description_free (tmp_desc);
|
pango_font_description_free (tmp_desc);
|
||||||
}
|
}
|
||||||
@ -663,21 +742,16 @@ gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
|
|||||||
if (old_desc)
|
if (old_desc)
|
||||||
pango_font_description_free (old_desc);
|
pango_font_description_free (old_desc);
|
||||||
|
|
||||||
if (match_row < 0 && n_faces)
|
fontsel->face = match_face;
|
||||||
match_row = 0;
|
if (match_face)
|
||||||
|
|
||||||
if (match_row >= 0)
|
|
||||||
{
|
{
|
||||||
fontsel->face = fontsel->faces[match_row];
|
const gchar *str = pango_font_face_get_face_name (fontsel->face);
|
||||||
gtk_clist_select_row (GTK_CLIST (fontsel->font_style_clist), match_row, 0);
|
|
||||||
|
|
||||||
str = pango_font_face_get_face_name (fontsel->face);
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (fontsel->font_style_entry), str);
|
gtk_entry_set_text (GTK_ENTRY (fontsel->font_style_entry), str);
|
||||||
}
|
|
||||||
else
|
|
||||||
fontsel->face = NULL;
|
|
||||||
|
|
||||||
gtk_clist_thaw (GTK_CLIST (fontsel->font_style_clist));
|
gtk_tree_selection_select_iter (selection, &match_row);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (faces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -690,65 +764,91 @@ static void
|
|||||||
gtk_font_selection_select_best_style (GtkFontSelection *fontsel,
|
gtk_font_selection_select_best_style (GtkFontSelection *fontsel,
|
||||||
gboolean use_first)
|
gboolean use_first)
|
||||||
{
|
{
|
||||||
gint best_row = 0;
|
GtkTreeIter iter;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
gtk_clist_select_row (GTK_CLIST (fontsel->font_style_clist), best_row, 0);
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->face_list));
|
||||||
if (gtk_clist_row_is_visible (GTK_CLIST (fontsel->font_style_clist), best_row)
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list));
|
||||||
!= GTK_VISIBILITY_FULL)
|
|
||||||
gtk_clist_moveto (GTK_CLIST (fontsel->font_style_clist), best_row, -1,
|
if (gtk_tree_model_get_iter_root (model, &iter))
|
||||||
0.5, 0);
|
{
|
||||||
gtk_font_selection_show_available_sizes (fontsel);
|
gtk_tree_selection_select_iter (selection, &iter);
|
||||||
|
scroll_to_selection (GTK_TREE_VIEW (fontsel->face_list));
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_font_selection_show_available_sizes (fontsel, FALSE);
|
||||||
gtk_font_selection_select_best_size (fontsel);
|
gtk_font_selection_select_best_size (fontsel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This is called when a style is selected in the list. */
|
/* This is called when a style is selected in the list. */
|
||||||
static void
|
static void
|
||||||
gtk_font_selection_select_style (GtkWidget *w,
|
gtk_font_selection_select_style (GtkTreeSelection *selection,
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
|
GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
|
||||||
gint index;
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
if (bevent && !GTK_WIDGET_HAS_FOCUS (w))
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||||
gtk_widget_grab_focus (w);
|
|
||||||
|
|
||||||
if (GTK_CLIST (fontsel->font_style_clist)->selection)
|
|
||||||
{
|
{
|
||||||
index = GPOINTER_TO_INT (GTK_CLIST (fontsel->font_style_clist)->selection->data);
|
PangoFontFace *face;
|
||||||
fontsel->face = fontsel->faces[index];
|
|
||||||
|
gtk_tree_model_get (model, &iter, FACE_COLUMN, &face, -1);
|
||||||
|
fontsel->face = face;
|
||||||
|
|
||||||
|
g_object_unref (face);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_font_selection_show_available_sizes (fontsel);
|
gtk_font_selection_show_available_sizes (fontsel, FALSE);
|
||||||
gtk_font_selection_select_best_size (fontsel);
|
gtk_font_selection_select_best_size (fontsel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel)
|
gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
|
||||||
|
gboolean first_time)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gint current_size = fontsel->size;
|
GtkListStore *model;
|
||||||
|
GtkTreeSelection *selection;
|
||||||
gchar buffer[128];
|
gchar buffer[128];
|
||||||
gchar *size;
|
|
||||||
|
model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->size_list)));
|
||||||
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list));
|
||||||
|
|
||||||
/* Insert the standard font sizes */
|
/* Insert the standard font sizes */
|
||||||
gtk_clist_freeze (GTK_CLIST (fontsel->size_clist));
|
if (first_time)
|
||||||
gtk_clist_clear (GTK_CLIST (fontsel->size_clist));
|
{
|
||||||
|
gtk_list_store_clear (model);
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (font_sizes); i++)
|
for (i = 0; i < G_N_ELEMENTS (font_sizes); i++)
|
||||||
{
|
{
|
||||||
sprintf (buffer, "%i", font_sizes[i]);
|
GtkTreeIter iter;
|
||||||
size = buffer;
|
|
||||||
gtk_clist_append (GTK_CLIST (fontsel->size_clist), &size);
|
|
||||||
if (font_sizes[i] * PANGO_SCALE == current_size)
|
|
||||||
gtk_clist_select_row (GTK_CLIST (fontsel->size_clist), i, 0);
|
|
||||||
}
|
|
||||||
gtk_clist_thaw (GTK_CLIST (fontsel->size_clist));
|
|
||||||
|
|
||||||
sprintf (buffer, "%i", current_size / PANGO_SCALE);
|
gtk_list_store_append (model, &iter);
|
||||||
|
gtk_list_store_set (model, &iter, SIZE_COLUMN, font_sizes[i], -1);
|
||||||
|
|
||||||
|
if (font_sizes[i] * PANGO_SCALE == fontsel->size)
|
||||||
|
gtk_tree_selection_select_iter (selection, &iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
gtk_tree_model_get_iter_root (GTK_TREE_MODEL (model), &iter);
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (font_sizes); i++)
|
||||||
|
{
|
||||||
|
if (font_sizes[i] * PANGO_SCALE == fontsel->size)
|
||||||
|
gtk_tree_selection_select_iter (selection, &iter);
|
||||||
|
|
||||||
|
gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf (buffer, "%i", fontsel->size / PANGO_SCALE);
|
||||||
gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer);
|
gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,23 +882,20 @@ gtk_font_selection_size_activate (GtkWidget *w,
|
|||||||
|
|
||||||
/* This is called when a size is selected in the list. */
|
/* This is called when a size is selected in the list. */
|
||||||
static void
|
static void
|
||||||
gtk_font_selection_select_size (GtkWidget *w,
|
gtk_font_selection_select_size (GtkTreeSelection *selection,
|
||||||
gint row,
|
|
||||||
gint column,
|
|
||||||
GdkEventButton *bevent,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkFontSelection *fontsel;
|
GtkFontSelection *fontsel;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
gint new_size;
|
gint new_size;
|
||||||
gchar *text;
|
|
||||||
|
|
||||||
fontsel = GTK_FONT_SELECTION (data);
|
fontsel = GTK_FONT_SELECTION (data);
|
||||||
|
|
||||||
if (bevent && !GTK_WIDGET_HAS_FOCUS (w))
|
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||||
gtk_widget_grab_focus (w);
|
{
|
||||||
|
gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
|
||||||
gtk_clist_get_text (GTK_CLIST (fontsel->size_clist), row, 0, &text);
|
new_size *= PANGO_SCALE;
|
||||||
new_size = atoi (text) * PANGO_SCALE;
|
|
||||||
|
|
||||||
if (fontsel->size != new_size)
|
if (fontsel->size != new_size)
|
||||||
{
|
{
|
||||||
@ -806,6 +903,7 @@ gtk_font_selection_select_size (GtkWidget *w,
|
|||||||
fontsel->size = new_size;
|
fontsel->size = new_size;
|
||||||
gtk_font_selection_load_font (fontsel);
|
gtk_font_selection_load_font (fontsel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -896,19 +994,22 @@ gtk_font_selection_get_font_name (GtkFontSelection *fontsel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This sets the current font, selecting the appropriate clist rows.
|
/* This sets the current font, selecting the appropriate list rows.
|
||||||
First we check the fontname is valid and try to find the font family
|
First we check the fontname is valid and try to find the font family
|
||||||
- i.e. the name in the main list. If we can't find that, then just return.
|
- i.e. the name in the main list. If we can't find that, then just return.
|
||||||
Next we try to set each of the properties according to the fontname.
|
Next we try to set each of the properties according to the fontname.
|
||||||
Finally we select the font family & style in the clists. */
|
Finally we select the font family & style in the lists. */
|
||||||
gboolean
|
gboolean
|
||||||
gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
|
gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
|
||||||
const gchar *fontname)
|
const gchar *fontname)
|
||||||
{
|
{
|
||||||
PangoFontFamily *new_family = NULL;
|
PangoFontFamily *new_family = NULL;
|
||||||
PangoFontFace *new_face = NULL;
|
PangoFontFace *new_face = NULL;
|
||||||
|
PangoFontFace *fallback_face = NULL;
|
||||||
PangoFontDescription *new_desc;
|
PangoFontDescription *new_desc;
|
||||||
gint n_families, n_faces, i;
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
gboolean valid;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), FALSE);
|
g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), FALSE);
|
||||||
|
|
||||||
@ -916,12 +1017,23 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
|
|||||||
|
|
||||||
/* Check to make sure that this is in the list of allowed fonts */
|
/* Check to make sure that this is in the list of allowed fonts */
|
||||||
|
|
||||||
n_families = GTK_CLIST (fontsel->font_clist)->rows;
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->family_list));
|
||||||
for (i = 0; i < n_families; i++)
|
for (valid = gtk_tree_model_get_iter_root (model, &iter);
|
||||||
|
valid;
|
||||||
|
valid = gtk_tree_model_iter_next (model, &iter))
|
||||||
{
|
{
|
||||||
if (g_strcasecmp (pango_font_family_get_name (fontsel->families[i]),
|
PangoFontFamily *family;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, &iter, FAMILY_COLUMN, &family, -1);
|
||||||
|
|
||||||
|
if (g_ascii_strcasecmp (pango_font_family_get_name (family),
|
||||||
pango_font_description_get_family (new_desc)) == 0)
|
pango_font_description_get_family (new_desc)) == 0)
|
||||||
new_family = fontsel->families[i];
|
new_family = family;
|
||||||
|
|
||||||
|
g_object_unref (family);
|
||||||
|
|
||||||
|
if (new_family)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_family)
|
if (!new_family)
|
||||||
@ -930,22 +1042,32 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
|
|||||||
fontsel->family = new_family;
|
fontsel->family = new_family;
|
||||||
gtk_font_selection_show_available_styles (fontsel);
|
gtk_font_selection_show_available_styles (fontsel);
|
||||||
|
|
||||||
n_faces = GTK_CLIST (fontsel->font_style_clist)->rows;
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->face_list));
|
||||||
for (i=0; i < n_faces; i++)
|
for (valid = gtk_tree_model_get_iter_root (model, &iter);
|
||||||
|
valid;
|
||||||
|
valid = gtk_tree_model_iter_next (model, &iter))
|
||||||
{
|
{
|
||||||
PangoFontDescription *tmp_desc = pango_font_face_describe (fontsel->faces[i]);
|
PangoFontFace *face;
|
||||||
|
PangoFontDescription *tmp_desc;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, &iter, FACE_COLUMN, &face, -1);
|
||||||
|
tmp_desc = pango_font_face_describe (face);
|
||||||
|
|
||||||
if (font_description_style_equal (tmp_desc, new_desc))
|
if (font_description_style_equal (tmp_desc, new_desc))
|
||||||
new_face = fontsel->faces[i];
|
new_face = face;
|
||||||
|
|
||||||
|
if (!fallback_face)
|
||||||
|
fallback_face = face;
|
||||||
|
|
||||||
pango_font_description_free (tmp_desc);
|
pango_font_description_free (tmp_desc);
|
||||||
|
g_object_unref (face);
|
||||||
|
|
||||||
if (new_face)
|
if (new_face)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_face)
|
if (!new_face)
|
||||||
new_face = fontsel->faces[0];
|
new_face = fallback_face;
|
||||||
|
|
||||||
fontsel->face = new_face;
|
fontsel->face = new_face;
|
||||||
gtk_font_selection_select_best_size (fontsel);
|
gtk_font_selection_select_best_size (fontsel);
|
||||||
|
@ -66,22 +66,18 @@ struct _GtkFontSelection
|
|||||||
{
|
{
|
||||||
GtkVBox parent_instance;
|
GtkVBox parent_instance;
|
||||||
|
|
||||||
GtkWidget *font_label;
|
|
||||||
GtkWidget *font_entry;
|
GtkWidget *font_entry;
|
||||||
GtkWidget *font_clist;
|
GtkWidget *family_list;
|
||||||
GtkWidget *font_style_entry;
|
GtkWidget *font_style_entry;
|
||||||
GtkWidget *font_style_clist;
|
GtkWidget *face_list;
|
||||||
GtkWidget *size_entry;
|
GtkWidget *size_entry;
|
||||||
GtkWidget *size_clist;
|
GtkWidget *size_list;
|
||||||
GtkWidget *pixels_button;
|
GtkWidget *pixels_button;
|
||||||
GtkWidget *points_button;
|
GtkWidget *points_button;
|
||||||
GtkWidget *filter_button;
|
GtkWidget *filter_button;
|
||||||
GtkWidget *preview_entry;
|
GtkWidget *preview_entry;
|
||||||
|
|
||||||
PangoFontFamily **families;
|
|
||||||
PangoFontFamily *family; /* Current family */
|
PangoFontFamily *family; /* Current family */
|
||||||
|
|
||||||
PangoFontFace **faces;
|
|
||||||
PangoFontFace *face; /* Current face */
|
PangoFontFace *face; /* Current face */
|
||||||
|
|
||||||
gint size;
|
gint size;
|
||||||
|
@ -353,7 +353,6 @@ gamma_cancel_callback (GtkWidget *w, gpointer data)
|
|||||||
GtkGammaCurve *c = data;
|
GtkGammaCurve *c = data;
|
||||||
|
|
||||||
gtk_widget_destroy (c->gamma_dialog);
|
gtk_widget_destroy (c->gamma_dialog);
|
||||||
c->gamma_dialog = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -394,6 +393,9 @@ button_clicked_callback (GtkWidget *w, gpointer data)
|
|||||||
|
|
||||||
c->gamma_dialog = gtk_dialog_new ();
|
c->gamma_dialog = gtk_dialog_new ();
|
||||||
gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), _("Gamma"));
|
gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), _("Gamma"));
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (c->gamma_dialog),
|
||||||
|
(gpointer *)&c->gamma_dialog);
|
||||||
|
|
||||||
vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
|
vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
|
||||||
|
|
||||||
hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
|
hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user