View | Details | Raw Unified | Return to bug 130159
Collapse All | Expand All

(-)gtk/gtkfontsel.c.old (-11 / +107 lines)
Lines 591-601 Link Here
591
gtk_font_selection_finalize (GObject *object)
591
gtk_font_selection_finalize (GObject *object)
592
{
592
{
593
  GtkFontSelection *fontsel;
593
  GtkFontSelection *fontsel;
594
  guint selection_timeout;
594
  
595
  
595
  g_return_if_fail (GTK_IS_FONT_SELECTION (object));
596
  g_return_if_fail (GTK_IS_FONT_SELECTION (object));
596
  
597
  
597
  fontsel = GTK_FONT_SELECTION (object);
598
  fontsel = GTK_FONT_SELECTION (object);
598
599
600
  selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "font-selection-timeout"));
601
  if (selection_timeout)
602
    g_source_remove (selection_timeout);
603
604
  selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "style-selection-timeout"));
605
  if (selection_timeout)
606
    g_source_remove (selection_timeout);
607
608
  selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "size-selection-timeout"));
609
  if (selection_timeout)
610
    g_source_remove (selection_timeout);
611
599
  if (fontsel->font)
612
  if (fontsel->font)
600
    gdk_font_unref (fontsel->font);
613
    gdk_font_unref (fontsel->font);
601
  
614
  
Lines 674-689 Link Here
674
}
687
}
675
688
676
/* This is called when a family is selected in the list. */
689
/* This is called when a family is selected in the list. */
677
static void
690
static gboolean
678
gtk_font_selection_select_font (GtkTreeSelection *selection,
691
gtk_font_selection_real_select_font (gpointer data)
679
				gpointer          data)
680
{
692
{
693
  GtkTreeSelection *selection;
681
  GtkFontSelection *fontsel;
694
  GtkFontSelection *fontsel;
682
  GtkTreeModel *model;
695
  GtkTreeModel *model;
683
  GtkTreeIter iter;
696
  GtkTreeIter iter;
684
  const gchar *family_name;
697
  const gchar *family_name;
685
  
698
  
699
  GDK_THREADS_ENTER ();
700
686
  fontsel = GTK_FONT_SELECTION (data);
701
  fontsel = GTK_FONT_SELECTION (data);
702
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list));
687
703
688
  if (gtk_tree_selection_get_selected (selection, &model, &iter))
704
  if (gtk_tree_selection_get_selected (selection, &model, &iter))
689
    {
705
    {
Lines 706-711 Link Here
706
722
707
      g_object_unref (family);
723
      g_object_unref (family);
708
    }
724
    }
725
726
  g_object_set_data (G_OBJECT (fontsel), "font-selection-timeout", GUINT_TO_POINTER (0));
727
728
  GDK_THREADS_LEAVE ();
729
730
  /* Remove ourselves */
731
  return FALSE;
732
}
733
734
static void
735
gtk_font_selection_select_font (GtkTreeSelection *selection,
736
				gpointer          data)
737
{
738
  GtkFontSelection *fontsel;
739
  guint selection_timeout = 0;
740
741
  fontsel = GTK_FONT_SELECTION (data);
742
  selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "font-selection-timeout"));
743
744
  if (selection_timeout)
745
    g_source_remove (selection_timeout);
746
747
  selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_font, data);
748
  g_object_set_data (G_OBJECT (fontsel), "font-selection-timeout", GUINT_TO_POINTER (selection_timeout));
709
}
749
}
710
750
711
static int
751
static int
Lines 908-921 Link Here
908
948
909
949
910
/* This is called when a style is selected in the list. */
950
/* This is called when a style is selected in the list. */
911
static void
951
static gboolean
912
gtk_font_selection_select_style (GtkTreeSelection *selection,
952
gtk_font_selection_real_select_style (gpointer data)
913
				 gpointer          data)
914
{
953
{
915
  GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
954
  GtkTreeSelection *selection;
955
  GtkFontSelection *fontsel;
916
  GtkTreeModel *model;
956
  GtkTreeModel *model;
917
  GtkTreeIter iter;
957
  GtkTreeIter iter;
918
  
958
  
959
  GDK_THREADS_ENTER ();
960
961
  fontsel = GTK_FONT_SELECTION (data);
962
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list));
963
919
  if (gtk_tree_selection_get_selected (selection, &model, &iter))
964
  if (gtk_tree_selection_get_selected (selection, &model, &iter))
920
    {
965
    {
921
      PangoFontFace *face;
966
      PangoFontFace *face;
Lines 928-933 Link Here
928
973
929
  gtk_font_selection_show_available_sizes (fontsel, FALSE);
974
  gtk_font_selection_show_available_sizes (fontsel, FALSE);
930
  gtk_font_selection_select_best_size (fontsel);
975
  gtk_font_selection_select_best_size (fontsel);
976
977
  g_object_set_data (G_OBJECT (fontsel), "style-selection-timeout", GUINT_TO_POINTER (0));
978
979
  GDK_THREADS_LEAVE ();
980
981
  /* Remove ourselves */
982
  return FALSE;
983
}
984
985
static void
986
gtk_font_selection_select_style (GtkTreeSelection *selection,
987
				 gpointer          data)
988
{
989
  GtkFontSelection *fontsel;
990
  guint selection_timeout = 0;
991
992
  fontsel = GTK_FONT_SELECTION (data);
993
  selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "style-selection-timeout"));
994
995
  if (selection_timeout)
996
    g_source_remove (selection_timeout);
997
998
  selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_style, data);
999
  g_object_set_data (G_OBJECT (fontsel), "style-selection-timeout", GUINT_TO_POINTER (selection_timeout));
931
}
1000
}
932
1001
933
static void
1002
static void
Lines 1062-1083 Link Here
1062
}
1131
}
1063
1132
1064
/* This is called when a size is selected in the list. */
1133
/* This is called when a size is selected in the list. */
1065
static void
1134
static gboolean
1066
gtk_font_selection_select_size (GtkTreeSelection *selection,
1135
gtk_font_selection_real_select_size (gpointer data)
1067
				gpointer          data)
1068
{
1136
{
1137
  GtkTreeSelection *selection;
1069
  GtkFontSelection *fontsel;
1138
  GtkFontSelection *fontsel;
1070
  GtkTreeModel *model;
1139
  GtkTreeModel *model;
1071
  GtkTreeIter iter;
1140
  GtkTreeIter iter;
1072
  gint new_size;
1141
  gint new_size;
1073
  
1142
  
1143
  GDK_THREADS_ENTER ();
1144
1074
  fontsel = GTK_FONT_SELECTION (data);
1145
  fontsel = GTK_FONT_SELECTION (data);
1075
  
1146
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list));
1147
1076
  if (gtk_tree_selection_get_selected (selection, &model, &iter))
1148
  if (gtk_tree_selection_get_selected (selection, &model, &iter))
1077
    {
1149
    {
1078
      gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
1150
      gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
1079
      gtk_font_selection_set_size (fontsel, new_size * PANGO_SCALE);
1151
      gtk_font_selection_set_size (fontsel, new_size * PANGO_SCALE);
1080
    }
1152
    }
1153
1154
  g_object_set_data (G_OBJECT (fontsel), "size-selection-timeout", GUINT_TO_POINTER (0));
1155
1156
  GDK_THREADS_LEAVE ();
1157
1158
  /* Remove ourselves */
1159
  return FALSE;
1160
}
1161
1162
static void
1163
gtk_font_selection_select_size (GtkTreeSelection *selection,
1164
				gpointer          data)
1165
{
1166
  GtkFontSelection *fontsel;
1167
  guint selection_timeout = 0;
1168
1169
  fontsel = GTK_FONT_SELECTION (data);
1170
  selection_timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "size-selection-timeout"));
1171
1172
  if (selection_timeout)
1173
    g_source_remove (selection_timeout);
1174
1175
  selection_timeout = g_timeout_add (200, gtk_font_selection_real_select_size, data);
1176
  g_object_set_data (G_OBJECT (fontsel), "size-selection-timeout", GUINT_TO_POINTER (selection_timeout));
1081
}
1177
}
1082
1178
1083
static void
1179
static void

Return to bug 130159