~ubuntu-branches/ubuntu/lucid/gedit/lucid-proposed

« back to all changes in this revision

Viewing changes to gedit/gedit-commands-search.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-03-18 00:37:05 UTC
  • mfrom: (1.1.76 upstream)
  • Revision ID: james.westby@ubuntu.com-20100318003705-typ8fgrsezmc334h
Tags: 2.29.9-0ubuntu1
* New upstream version:
  - Fix a file corruption bug in the new file saving code 
  - Misc bugfixes
* debian/patches/80_not_using_localmodlibs.patch:
  - dropped, the change is in the new version

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
last_search_data_restore_position (GeditSearchDialog *dlg)
67
67
{
68
68
        LastSearchData *data;
69
 
        
 
69
 
70
70
        data = g_object_get_data (G_OBJECT (dlg), GEDIT_LAST_SEARCH_DATA_KEY);
71
 
        
 
71
 
72
72
        if (data != NULL)
73
73
        {
74
74
                gtk_window_move (GTK_WINDOW (dlg),
75
75
                                 data->x,
76
76
                                 data->y);
77
 
                
78
 
                gedit_search_dialog_present_with_time (dlg,
79
 
                                                       GDK_CURRENT_TIME);
80
77
        }
81
78
}
82
79
 
454
451
        }
455
452
}
456
453
 
 
454
static gboolean
 
455
search_dialog_delete_event_cb (GtkWidget   *widget,
 
456
                               GdkEventAny *event,
 
457
                               gpointer     user_data)
 
458
{
 
459
        gedit_debug (DEBUG_COMMANDS);
 
460
 
 
461
        /* prevent destruction */
 
462
        return TRUE;
 
463
}
 
464
 
457
465
static void
458
466
search_dialog_destroyed (GeditWindow       *window,
459
467
                         GeditSearchDialog *dialog)
468
476
                           NULL);
469
477
}
470
478
 
 
479
static GtkWidget *
 
480
create_dialog (GeditWindow *window, gboolean show_replace)
 
481
{
 
482
        GtkWidget *dialog;
 
483
 
 
484
        dialog = gedit_search_dialog_new (GTK_WINDOW (window), show_replace);
 
485
 
 
486
        g_signal_connect (dialog,
 
487
                          "response",
 
488
                          G_CALLBACK (search_dialog_response_cb),
 
489
                          window);
 
490
        g_signal_connect (dialog,
 
491
                         "delete-event",
 
492
                         G_CALLBACK (search_dialog_delete_event_cb),
 
493
                         NULL);
 
494
 
 
495
        g_object_set_data (G_OBJECT (window),
 
496
                           GEDIT_SEARCH_DIALOG_KEY,
 
497
                           dialog);
 
498
 
 
499
        g_object_weak_ref (G_OBJECT (dialog),
 
500
                           (GWeakNotify) search_dialog_destroyed,
 
501
                           window);
 
502
 
 
503
        return dialog;
 
504
}
 
505
 
471
506
void
472
507
_gedit_cmd_search_find (GtkAction   *action,
473
508
                        GeditWindow *window)
485
520
 
486
521
        if (data == NULL)
487
522
        {
488
 
                search_dialog = gedit_search_dialog_new (GTK_WINDOW (window),
489
 
                                                         FALSE);
490
 
                
491
 
                g_signal_connect (search_dialog,
492
 
                                  "response",
493
 
                                  G_CALLBACK (search_dialog_response_cb),
494
 
                                  window);
495
 
                
496
 
                g_object_set_data (G_OBJECT (window),
497
 
                                   GEDIT_SEARCH_DIALOG_KEY,
498
 
                                   search_dialog);
499
 
                
500
 
                g_object_weak_ref (G_OBJECT (search_dialog),
501
 
                                   (GWeakNotify) search_dialog_destroyed,
502
 
                                   window);
 
523
                search_dialog = create_dialog (window, FALSE);
503
524
        }
504
525
        else
505
526
        {
533
554
 
534
555
        gtk_widget_show (search_dialog);
535
556
        last_search_data_restore_position (GEDIT_SEARCH_DIALOG (search_dialog));
 
557
        gedit_search_dialog_present_with_time (GEDIT_SEARCH_DIALOG (search_dialog),
 
558
                                               GDK_CURRENT_TIME);
536
559
}
537
560
 
538
561
void
549
572
        gedit_debug (DEBUG_COMMANDS);
550
573
 
551
574
        data = g_object_get_data (G_OBJECT (window), GEDIT_SEARCH_DIALOG_KEY);
552
 
        
 
575
 
553
576
        if (data == NULL)
554
577
        {
555
 
                replace_dialog = gedit_search_dialog_new (GTK_WINDOW (window),
556
 
                                                          TRUE);
557
 
                
558
 
                g_signal_connect (replace_dialog,
559
 
                                  "response",
560
 
                                  G_CALLBACK (search_dialog_response_cb),
561
 
                                  window);
562
 
                
563
 
                g_object_set_data (G_OBJECT (window),
564
 
                                   GEDIT_SEARCH_DIALOG_KEY,
565
 
                                   replace_dialog);
566
 
                
567
 
                g_object_weak_ref (G_OBJECT (replace_dialog),
568
 
                                   (GWeakNotify) search_dialog_destroyed,
569
 
                                   window);
 
578
                replace_dialog = create_dialog (window, TRUE);
570
579
        }
571
580
        else
572
581
        {
600
609
 
601
610
        gtk_widget_show (replace_dialog);
602
611
        last_search_data_restore_position (GEDIT_SEARCH_DIALOG (replace_dialog));
 
612
        gedit_search_dialog_present_with_time (GEDIT_SEARCH_DIALOG (replace_dialog),
 
613
                                               GDK_CURRENT_TIME);
603
614
}
604
615
 
605
616
static void