Ignore:
Timestamp:
07/04/07 18:35:23 (6 years ago)
Author:
njp
Message:

2007-07-04 Neil J. Patel <njp@…>

  • src/moko-dialer.c: (on_history_dial_number), (moko_dialer_init): Connect to new "dial_number" signal in MokoHistory?
  • src/moko-history.c: (on_dial_clicked), (moko_history_class_init):
  • src/moko-history.h: Add a "dial_number" signal to alert the MokoDialer? object that the user wants to dial a number.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/applications/openmoko-dialer/src/moko-history.c

    r2461 r2462  
    6868enum 
    6969{ 
     70  DIAL_NUMBER, 
     71 
     72  LAST_SIGNAL 
     73}; 
     74 
     75static guint history_signals[LAST_SIGNAL] = {0, }; 
     76 
     77enum 
     78{ 
    7079  PROP_JOURNAL=1 
    7180}; 
     
    8190}; 
    8291 
     92 
    8393static void 
    8494on_dial_clicked (GtkWidget *button, MokoHistory *history) 
    8595{ 
    86   g_print ("dial clicked\n"); 
     96  MokoHistoryPrivate *priv; 
     97  GtkTreeSelection *selection; 
     98  GtkTreeView *treeview; 
     99  GtkTreeIter iter; 
     100  GtkTreeModel *model; 
     101  gchar *number; 
     102  
     103  g_return_if_fail (MOKO_IS_HISTORY (history)); 
     104  priv = history->priv; 
     105 
     106  treeview = GTK_TREE_VIEW (priv->treeview); 
     107  selection = gtk_tree_view_get_selection (treeview); 
     108  model = gtk_tree_view_get_model (treeview); 
     109 
     110  if (!gtk_tree_selection_get_selected (selection, &model, &iter)) 
     111    return; 
     112 
     113  gtk_tree_model_get (model, &iter, NUMBER_COLUMN, &number, -1); 
     114 
     115  g_signal_emit (G_OBJECT (history), history_signals[DIAL_NUMBER], 0, number); 
     116 
     117  g_free (number); 
    87118} 
    88119 
     
    391422                         "A MokoJournal Object", 
    392423                         G_PARAM_CONSTRUCT|G_PARAM_READWRITE)); 
     424  history_signals[DIAL_NUMBER] = 
     425    g_signal_new ("dial_number",  
     426                  G_TYPE_FROM_CLASS (obj_class), 
     427                  G_SIGNAL_RUN_LAST, 
     428                  G_STRUCT_OFFSET (MokoHistoryClass, dial_number), 
     429                  NULL, NULL, 
     430                  g_cclosure_marshal_VOID__STRING, 
     431                  G_TYPE_NONE,  
     432                  1, G_TYPE_STRING); 
    393433 
    394434  g_type_class_add_private (obj_class, sizeof (MokoHistoryPrivate));  
Note: See TracChangeset for help on using the changeset viewer.